my dog learned polymorphism*
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

Vishnu Prakash
Ranch Hand

Joined: Nov 15, 2004
Posts: 1026
From Spec:

For a servlet implementing the SingleThreadModel interface, the servlet container may instantiate multiple instances to handle a heavy request load and serialize requests to a particular instance.

What does this mean


and serialize requests to a particular instance.


Servlet Spec 2.4/ Jsp Spec 2.0/ JSTL Spec 1.1 - JSTL Tag Documentation
Sravan Kumar
Ranch Hand

Joined: Sep 11, 2005
Posts: 121
It means what it says!

Servlets implementing SingleThreadModel cannot be run on two threads at the same time. So, if there are mutiple requests, the servlet container will create a pool of instances for this servlet and dispatch each request to a different instance.

Note that SingleThreadModel has been deprecated in Servlet Spec 2.4 and programmers are strictly advised not to use this. Though SingleThreadModel seems lucrative for solving mutil-threading problems, it actually does not !!


keep smilin :: sravan<br /><a href="http://sravanpens.blogspot.com" target="_blank" rel="nofollow">I scribble here</a>
Vishnu Prakash
Ranch Hand

Joined: Nov 15, 2004
Posts: 1026
Hello

Your answer doesn't seem to answer my Question.
Sravan Kumar
Ranch Hand

Joined: Sep 11, 2005
Posts: 121
It means it will dispatch every new request to separate instances.
Vishnu Prakash
Ranch Hand

Joined: Nov 15, 2004
Posts: 1026
Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SingleThreadModel