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


Please Help Members By Posting Answers For Below Questions

Whether thread can be used in servlets?

940


What is preinitialization of a servlet?

775


How can the session in servlet be destroyed?

874


Can we use threads in Servlets?

844


How can we perform any action at the time of deploying the project?

875


Explain jsessionid and when is it created?

792


What is the capacity the doget can send to the server?

799


What are the new features added to servlet 2.5?

833


What is servlet and how it works?

679


What are the functions of the servlet container?

1317


How do you create a cookie using servlet?

835


When using servlets to build the HTML, you build a DOCTYPE line, why do you do that?

770


What is servlet and its advantages?

771


Explain the war file?

825


Servlet is pure java object or not?

923