On Fri, 23 Mar 2001, Pradeep Kumar wrote:
> The Servlet specification says that, that the container should guarantee only
> one instance of the servlet. However some of the container do maintain a
> small of pool of servlet instances and manage them. For example there are 3
> instances of a servlet in the pool, and if there are 300 requests, each
> instance spawns off 100 threads for 100 requests.
> I don't know how far this is true with Tomcat. In general you should not make
> any assumptions about the number of instances of your servlet.
>
Maintaining instance pools is *only* allowed for servlets that implement
the SingleThreadModel interface. Otherwise, the container is required to
provide exactly one instance of the servlet per servlet definition
(i.e. either the <servlet> declaration in your web.xml file, or a
dynamically created definition when you call /servlet/{servletname}).
Tomcat does not currently implement instance pooling for SingleThreadModel
servlets, although it could legally do so.
> pradeep
>
Craig McClanahan