What is Single Threaded Model in Servlets? Explain this
with an example?
Answer Posted / m.rajkumar
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 ? | 1 Yes | 0 No |
Post New Answer View All Answers
What is servlet configuration?
What is the type of method for sending request from http server?
What is the difference between context parameter and context attribute?
Where do you define dispatcherservlet?
What is the advantage of Servlets when compared with other server side technologies?
What are the life-cycle methods for a servlet?
Are Servlets Thread Safe? How to achieve thread safety in servlets?
How to read request headers from servlets?
What are the ways to handle multi-threading in servlets?
What do you mean by chaining in servlet?
Explain web application directory arrangement?
Which event is fired at the time of setting, getting or removing attribute from application scope?
What is a servlet engine?
How to notify an object in session when session is invalidated or timed-out?
Difference between httpservlet and generic servlets?