Forums Register Login

Question regarding SingleThreadModel

+Pie Number of slices to send: Send
In one E - Book i have read that -:

" Recall that multiple client requests to the same servlet result only
in multiple threads calling the service method of a single servlet instance.
They do not result in the creation of multiple servlet instances except possibly when the servlet implements SingleThreadModel."

In above it is written that it will create multiple instance of Servlet if we implements SingleThreadmodel, but i think that only one instance of servlet is created , so how is it possible that many instance of one servlet will be created, it will nullify the usuage of servlet if it will create many instance of the same servlet.

Thanks
Regards
Gaurav
+Pie Number of slices to send: Send
From the Java API on SingleThreadModel


As you can see, whether to create a single instance (and to provide a synchronized access) or to create multiple instances, depends on the implementation of the Servlet container.
But if multiple instances are created, the containers generally pool them to improve the performance.
[ November 23, 2005: Message edited by: Mani Ram ]
+Pie Number of slices to send: Send
Gaurav,

This thread from last week might interest you.
In it, singleThreadModel was discussed quite a bit.

https://coderanch.com/t/361606/Servlets/java/Pooling-Servlet
If you open the box, you will find Heisenberg strangling Shrodenger's cat. And waving this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 909 times.
Similar Threads
Which of the following statements is correct regarding the servlets that implement
question on servlet
Doubt from HFSJ chap.5 mock exam
Number of Instances Per Servlet
Servlet instances and its init method
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 20:16:31.