Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SingleThreadModel

 
Krishna Srinivasan
Ranch Hand
Posts: 1862
Firefox Browser Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why sun planning to deprecate SingleThreadModel interface from the next version.what is the disadvantage of using SingleThreadModel?
 
Idly Vada
Ranch Hand
Posts: 135
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 116
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1862
Firefox Browser Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank U
 
Chris Mathews
Ranch Hand
Posts: 2712
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic