This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes SingleThreadModel interface - deprecated Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "SingleThreadModel interface - deprecated" Watch "SingleThreadModel interface - deprecated" New topic
Author

SingleThreadModel interface - deprecated

Vishwa Kumba
Ranch Hand

Joined: Aug 27, 2003
Posts: 1064
SingleThreadModel interface has been deprecated in J2EE 1.4.

The reason as I understand from the docs is:

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.


I wonder why this realisation only in Servlet 2.4? I always thought this was a problem even in the previous versions.

Finally Sun is not recommending the use of SingleThreadModel.
Arto Pastinen
Ranch Hand

Joined: Dec 13, 2002
Posts: 79
heh.. quite funny.

Maby next Sun will recommend not to use clustering, beacause there is no support to lock session between nodes..
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: SingleThreadModel interface - deprecated
 
Similar Threads
Multiple instances and multiple threads
Doubt in Thread Safe Servlet.
Single Thread Model
Is Sessions thread safe if servlet implement SingleThreadModel interface ?
Single Thread Model