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
What are the servlet events?
What are common tasks performed by Servlet Container?
What is the difference between jsp and servlet life cycle?
Define servlet mapping?
What exactly is a servlet?
What is lazy loading and what is Generic Servlet Class?
What is the use of send redirect () method?
What are the annotations used in servlet 3?
How to get ip address in jsp login page and how to validate like 127.1.0.1 all should not be greater than 255
What is servlet mapping?
What is cookie in servlet?
What do you mean by scope object and what are its types?
Is servlet thread safe?
In the servlets, we are having a web page that is invoking servlets ,username and password? which is checks in database? Suppose the second page also if we want to verify
Can you explain in detail 'javax.servlet' package?