File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes SingleThreadModel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
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://aspose.com/file-tools
 
subject: SingleThreadModel