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 are the uses of servlets?
What is setattribute in servlet?
What is the
What is java servlet?
How can you create a session in servlet?
What is cgi and what are its drawbacks?
How native code can be used in a servlet?
When should you prefer to use doget() over dopost()?
What is MIME Type?
What is the difference between Servlet Request and Servlet Context when calling a Request Dispatcher?
What are the different methods involved in the process of session management in servlets?
How can we refresh automatically when new data is entered into the database?
Can we refresh servlet in client and server side automatically?
What is the workflow of a servlet?
What is called Session Tracking?