In a nut shell, if a servlet implements Single Thread Model, the container will provide a new copy of it for each request. It was deprecated because its name gave the false impression that implementing it guaranteed thread safety.
If a servlet is implementing SingleThreadModel thn container will synchronize access to service(). threre can not be more thn one thread running through service method.
Originally posted by sudhir nim: If a servlet is implementing SingleThreadModel thn container will synchronize access to service()
No, this is one way in which it can be implemented.
From the API:
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.
Ya thats true. Whatever the case, container guarantees that only one thread is accessing service() method at a time.
It is irrelevant, I think programmer doesnt need to know weather container is synchronizing the access or maintaining the pool. [ November 05, 2007: Message edited by: sudhir nim ]
Its transparent to developer. Developer doesnt need to know it. What one could achieve if he know that container has pooled the servlet instances and not synchronized the service method()?
You may correct me if I am wrong. [ November 05, 2007: Message edited by: sudhir nim ]