How to make servlet thread safe?
Answer Posted / shakir khan
There are situations where we want to protect your servlet
member variables from being modified by different
clients.In this case you can have your servlet by
implementing the marker interface SigleThreadModel.
Everytime a client makes request to a servlet by
implementing this interface,servlet engine will create a
new instance of servlet.
For performance reason,servlet engine can also maintain a
instance pool,handing out instances as they are needed.Or
it could also serialize client request executing one after
another.
| Is This Answer Correct ? | 49 Yes | 9 No |
Post New Answer View All Answers
Who is responsible to create the object of servlet?
Define servlet mapping?
How do you invoke a servelt?
What are sessions in servlets?
How we can call a jsp from the servlet?
What are all the advantages of servlet over cgi?
When should you prefer to use doget() over dopost()?
What is new in ServletRequest interface ? (Servlet 2.4)
What is cookies in servlet with example?
What is the difference between CGI and Servlet?
What is load-on-startup in servlet?
What are advantages of servlets over cgi?
What is the GenericServlet class?
How do I support both get and post from the same servlet?
Explains the differences between context.getrequestdispatcher() and request.getrequestdispatcher()?