3.2 Number of Instances
By default, there must be only one instance of a servlet class per servlet definition in a container.
In the case of a servlet that implements the
SingleThreadModel interface, the servlet container
may instantiate multiple instances of that servlet so that it can handle a heavy request load while
still serializing requests to a single instance.
In the case where a servlet was deployed as part of an application that is marked in the deployment
descriptor as distributable, there is one instance of a servlet class per servlet definition per VM in a
container. If the servlet implements the
SingleThreadModel interface as well as is part of a
distributable web application, the container may instantiate multiple instances of that servlet in
each VM of the container.
3.2.1 Note about
SingleThreadModel The use of the
SingleThreadModel interface guarantees that one thread at a time will execute
through a given servlet instance’s service method. It is important to note that this guarantee only
applies to servlet instance. Objects that can be accessible to more than one servlet instance at a
time, such as instances of
HttpSession, may be available to multiple servlets, including those
that implement
SingleThreadModel, at any particular time.