File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes servlet pooling Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "servlet pooling" Watch "servlet pooling" New topic
Author

servlet pooling

app yadav
Greenhorn

Joined: Mar 07, 2005
Posts: 11
Hello,
Can anyone please tell me where can i specify the size of pool for the servlet.

Thanks in advance.
Aparna.
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
You dont need to.

Actually, container doesn't really do pooling for servlet instances. There is a seperate thread for every request entertained by the same servlet instance. Container might create multiple instances of a servlet when it like to. You need not bother with this thing.

Thanks.
Sunny Kumar
Ranch Hand

Joined: Oct 27, 2005
Posts: 57
For more information discussing the similar issue you can have a look at Pooling of servlet thread.
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
[co-incidence]
Sunny and Ben, you both pointed to the same thread.
[ November 29, 2005: Message edited by: Adeel Ansari ]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Doh!
He posted first so I'll pull mine down.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
app yadav
Greenhorn

Joined: Mar 07, 2005
Posts: 11
So there is no way by which a programmer can specify the pool size if a servlet implements SingleThreadModel.This would be totally server specific.Am i right?

Aparna
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

To the best of my knowledge, there isn't anything in the spec requiring servlet pooling. So, yes, this would be container specific.



SRV.2.2.1 Note About The Single Thread Model

The use of the SingleThreadModel interface guarantees that only one thread at a
time will execute in a given servlet instance's service method. It is important to
note that this guarantee only applies to each servlet instance, since the container
may choose to pool such objects. Objects that are accessible to more than one serv-
let instance at a time, such as instances of HttpSession, may be available at any par-
ticular time to multiple servlets, including those that implement
SingleThreadModel.
It is recommended that a developer take other means to resolve those issues instead
of implementing this interface, such as avoiding the usage of an instance variable or
synchronizing the block of the code accessing those resources. The
SingleThreadModel Interface is deprecated in this version of the specification.



 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: servlet pooling