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
Describe the phases of servlet lifecycle?
Should I override the service() method?
What do you mean by the servlet chaining?
What is the capacity the doget can send to the server?
Why is Servlet so popular?
Define declaration.
What’s the difference between sendredirect and forward methods
What is the requirement of servlet config and servlet context implemented and how are they implemented?
What is the difference between genericservlet and httpservlet
What is servlet lazy loading?
What is meant by session? Tell me something about httpsession class?
What is the major difference between servlet and applet?
Explain the role of dispatcherservlet and contextloaderlistener.
What is the need of session tracking in web application?
How do you communicate in between Applets and Servlets?