Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes A question about 'single-threaded mode' Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "A question about Watch "A question about New topic
Author

A question about 'single-threaded mode'

Tiffiny Yang
Ranch Hand

Joined: Mar 29, 2006
Posts: 124
Mock QUESTION :
If a servlet is designed to execute in single-threaded mode as part of a distributed Web application, which is true?
A. The servlet container must only instantiate one instance of the servlet within each Java Virtual Machine.
B. The servlet definition in the Web application deployment descriptor must include the element.
C. The servlet container may instantiate multiple instances of that servlet in each Java Virtual Machine within the container.
D. The servlet container manages the thread-safety of the session object within each of the Java Virtual Machines in the distributed application.

The answer is C.
Can anybody explain why? and Is the single-Thread related questions on the exam ?

Thanks in advance
PRavi kumar
Ranch Hand

Joined: May 13, 2007
Posts: 69
Hi,

The SingleThreadModel is not in Exam.
Atul Sawant
Ranch Hand

Joined: Jul 06, 2006
Posts: 304
There is only one single instance of a servlet in a JVM. So, in that context i think even 'a' is correct.


Mission SCWCD. Mission SCJP Complete: SCJP 1.4 - 91%
Mark Garland
Ranch Hand

Joined: Nov 11, 2006
Posts: 226
I'm not so sure.
I'm sure I remember getting an old mock question wrong once as the JVM was free to make as many instances of the servlet as it wanted, provided each was only handling one thread at once.

Open to correction.


28/06/06 - SCJP - 69%, 05/06/07 - SCWCD - 92%, 28/02/08 - IBM DB2 v9 Fundamentals (Exam 730) - 87%, 18/11/08 - IBM DB2 v9 DBA (Exam 731) - 89%, 26/02/11 - SCBCD - 88%
Manwatkar Vaibhav
Greenhorn

Joined: Jun 11, 2007
Posts: 26
According to me, Answer C is correct because..

In Single Thread Model of Servlets, for each request, an Instance of that Servlet is newly created or an Instance from the Container Managed Pool is allocated.


Regards,<br />---------<br />Vaibhav<br />SCJP 1.4<br />SCWCD 1.4<br />---------
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: A question about 'single-threaded mode'
 
Similar Threads
Nubmer of servlet instance
Servlet instances
Counter using Session Tracking !!
Does it make any need to have static variables inside a Servlet
Requests to Servlets