javax.servlet.SingleThreadModel翻译

王朝java/jsp·作者佚名  2006-01-09
宽屏版  字体: |||超大  

[/url] [url=file:///F:/资料/文字资料/j2ee-1.4_doc/apidocs/overview-summary.html]Overview

Package

Class

Tree

Deprecated

Index

Help

JavaTM 2 Platform

Ent. Ed. v1.4

PREV CLASS NEXT CLASS

FRAMES NO FRAMES All Classes

SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

javax.servlet

Interface SingleThreadModelDeprecated. As of Java Servlet API 2.4, with no direct replacement.

public interface SingleThreadModelEnsures that servlets handle only one request at a time. This interface has no methods. 确保servlet每次只处理一项请求。接口不含方法。

If a servlet implements this interface, you are guaranteed that no two threads will execute concurrently in the servlet's service method. The servlet container can make this guarantee by synchronizing access to a single instance of the servlet, or by maintaining a pool of servlet instances and dispatching each new request to a free servlet. 如果servlet实现了该接口,会确保不会有两个线程同时执行servlet的service方法。 servlet容器通过同步化访问servlet的单实例来保证,也可以通过维持servlet的实例池,对于新的请求会分配给一个空闲的servlet。

Note that SingleThreadModel does not solve all thread safety issues. For example, session attributes and static variables can still be accessed by multiple requests on multiple threads at the same time, even when SingleThreadModel servlets are used. It is recommended that a developer take other means to resolve those issues instead of implementing this interface, such as avoiding the usage of an instance variable or synchronizing the block of the code accessing those resources. This interface is deprecated in Servlet API version 2.4. 注意:SingleThreadModel不会解决所有的线程安全隐患。 例如,会话属性和静态变量仍然可以被多线程的多请求同时访问,即便使用了SingleThreadModel servlet。建议开发人员应当采取其他手段来解决这些问题,而不是实现该接口,比如 避免实例变量的使用或者在访问资源时同步代码块。该接口在ServletAPI 2.4中将不推荐使用。

Version: $Version$ Author: Various

[/url][url=file:///F:/资料/文字资料/j2ee-1.4_doc/apidocs/overview-summary.html]Overview

Package

Class

Tree

Deprecated

Index

Help

JavaTM 2 Platform

Ent. Ed. v1.4

PREV CLASS NEXT CLASS

FRAMES NO FRAMES All Classes

SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

Submit a bug or feature Copyright 2003 Sun Microsystems, Inc. All rights reserved.

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
© 2005- 王朝网络 版权所有