wood burning stoves 2.0*
The moose likes Servlets and the fly likes SingleThreadModel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "SingleThreadModel" Watch "SingleThreadModel" New topic
Author

SingleThreadModel

Krishna Srinivasan
Ranch Hand

Joined: Jul 28, 2003
Posts: 1844

Why sun planning to deprecate SingleThreadModel interface from the next version.what is the disadvantage of using SingleThreadModel?


Krishna Srinivasan
Spring Tutorials, OCAJP Mock Questions, 400+ OCPJP Mock Questions
Idly Vada
Ranch Hand

Joined: Sep 02, 2003
Posts: 135
Servlets are a huge burden on the web server. Threads are lightweight components. Consider a situation where no. of requests is very high, having large no. of servlets will cause serious performance problem.

And it is better to use servlets only as controllers and using them to perform long operations should be avoided.
Gayathri Prasad
Ranch Hand

Joined: Jun 25, 2003
Posts: 116
Hi,
Single Thread Model might choke the web server .. i.e typically in a Single thread model what happens is the web server assigns a client to a single instance of a Servlet and when the requests go up... it finally bogs down the web server and thats the reason ( I think) Sun wants to do away with the Single Thread model.

Cheers,
Gaya3
Krishna Srinivasan
Ranch Hand

Joined: Jul 28, 2003
Posts: 1844

Thank U
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
Originally posted by Gayathri Prasad:
Single Thread Model might choke the web server .. i.e typically in a Single thread model what happens is the web server assigns a client to a single instance of a Servlet and when the requests go up... it finally bogs down the web server and thats the reason ( I think) Sun wants to do away with the Single Thread model.

Actually, the real reason that it is being deprecated is that implementing SingleThreadModel still does not guarantee thread safety and can lead to a false sense of security. Access to the Servlet instance itself is serialized but access to shared resources such as the ServletContext and HttpSession are not. Therefore, developers will falsely assume that there can be no threading issues if they implement SingleThreadModel.
SingleThreadModel was a mistake from the beginning. It was an attempt to accomdate developers that don't know how to write good code... unfortunately this attempt was doomed to fail.
See this thread for a similar discussion.
[ September 06, 2003: Message edited by: Chris Mathews ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SingleThreadModel