Does each HTTP request access the same servlet object but in a different thread? or does it create a new thread and new Servlet Instance ?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The container will use the same servlet instance if your servlet don’t implement
SingleThreadModel.Otherwise there is no guarantee that the same
Servletobject is hit. The container is free to create more servlet instances if it considers necessary. But the requests comes on different threads, not necessarily newly created (as Sanjay mentioned).From the Servlet 3.0 specification:
…