wood burning stoves 2.0*
The moose likes Servlets and the fly likes Single Thread Model 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 "Single Thread Model" Watch "Single Thread Model" New topic
Author

Single Thread Model

Nikhil Bansal
Greenhorn

Joined: Mar 21, 2006
Posts: 21
Hi All,

Why is single thread model deprecated in the latest versions on Servlet API.

Regards

Nikhil
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

From the API:

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.

Baically to be thread safe you need to consider all threading issues, and since the Single ThreadModel doesn't really provide anything except a brute force attempt at this, it creates the illusion of thread safety and needs to go.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Single Thread Model
 
Similar Threads
Variable Integrity---I'm scared!!!
synchronized(page) is jsp
single thread or multi thread ?
Is Servlet SingleThread Model or Multithread Model by default?
Thread Models