I am going through the book for \"Java Web Services: Up and Running, 2nd Edition\" and came across a statement that says:
A web server such as Tomcat
by default servlets are intrinsic multithreaded. so only single instance be created and will be accessed by multiple threads.
The Servlet Specification states
For a servlet not hosted in a distributed environment (the default), the servlet container must use only one instance per servlet declaration. However, for a servlet implementing the
SingleThreadModel
interface, the servlet container may instantiate multiple instances to handle a heavy request load and serialize requests to a particular instance.In the case where a servlet was deployed as part of an application marked in the deployment descriptor as distributable, a container may have only one instance per servlet declaration per Java Virtual Machine (JVM). However, if the servlet in a distributable application implements the
SingleThreadModel
interface, the container may instantiate multiple instances of that servlet in each JVM of the container.
So it depends how you are deployed.
As suggested in the comments, SingleThreadModel has been deprecated for a long time.