You would not believe that this simple looking innocent question (If I may say so.) at times bowls out quite a few experts. Another way of asking this question is that if multiple concurrent hit comes to a Servlet (E.g. LoginServlet), then in that case are they served by the same instance of the servlet or a new instance of each request.
The correct answers is that by default Servlets in Java are not thread safe (though they could be made ThreadSafe by implementing SingleThreadModel). So that would mean that if there are multiple concurrent requests to the same servlet it would be served by the same instance.
No comments:
Post a Comment