How many times init() method gets called when we implement the single thread model. I think it's only one time only, is it correct? . As I know for each request servlet container creates one servlet instance to serve the incoming request. Does init() method gets called for each servlet instance?
1. Only one servlet instance and other request will wait in queue to get chance
2. For each request servlet container creates new servlet instance.
these techniques depends on third party vendors .
If a servlet implements this interface, you are guaranteed that no two threads will execute concurrently in the servlet's service method. The servlet container can make this guarantee by synchronizing access to a single instance of the servlet, or by maintaining a pool of servlet instances and dispatching each new request to a free servlet.
so as of tomcat 5.5, it wont create a new instance of servlet for each request even servlet implements SingleThreadModel. instead it synchorize access to service method.