This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes SingleThreadModel Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Reply Bookmark "SingleThreadModel" Watch "SingleThreadModel" New topic
Author

SingleThreadModel

Latha Kota
Ranch Hand

Joined: Mar 13, 2003
Posts: 35
I have come across this question in HFSJ mock exam. It says that this statement is true. Can anybody explain me why?

If the servlet does not implement SingleThreadModel, the container will create no more than one instance per JVM.

Thanks,
Latha.
kapil munjal
Ranch Hand

Joined: May 11, 2004
Posts: 298
Yes, this statement is correct.

If we dont implement SingleThreadModel, then there will be only one instance of the servlet which will serve all the request.

If we implement SingleThreadModel, and we have to server 5 request simultaneously, only then we can do the configuration of creation of more than one instance of the servlet.


Kapil Munjal
SCJP 1.4, SCWCD 1.4
Mat Williams
Ranch Hand

Joined: Jul 20, 2005
Posts: 215
Hi,

essentially if the Servlet does not implement SingleThreadModel then the server considers it to be thread safe, and thus all requests the go to the same instance of the servlet in different threads. This means, that at any one point in time, there may be more than one thread executing through the same servlet.

HTH

Mat
Latha Kota
Ranch Hand

Joined: Mar 13, 2003
Posts: 35
Thanks Kapil and Mat. I now understood it better.
Latha
SCJP 1.4
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: SingleThreadModel
 
Similar Threads
Starting servlets
what is SingleThreadModel?
Single Threaded Model Question
A question about 'single-threaded mode'
Servelet instances created in web.xml