How to make servlet thread safe?
Answer Posted / bhaskar padala
The servlet programmer should implement SingleThreadModel interface to ensure that servlet can handle only one request at a time. It is a marker interface, means have no methods.
This interface is currently deprecated since Servlet API 2.4 because it doesn't solves all the thread-safety issues such as static variable and session attributes can be accessed by multiple threads at the same time even if we have implemented the SingleThreadModel interface. So it is recommended to use other means to resolve these thread safety issues such as synchronized block etc.
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
What must be implemented by all servlets?
How do you communicate in between Applets and Servlets?
What are the different session tracking techniques?
What is a servlet engine?
When Servlet is unloaded?
How do you load an image in a Servlet?
Explain Action Servlet?
Is servlet synchronized?
What are the jobs performed by servlets?
Whether we can get deadlock situation in servlets?
How can a servlet be used to generate plain text instead of html?
What is the difference between servlet and filter?
What is a generic servlet?
What is the workflow of a servlet?
Can servlet have a constructor ?