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

Tell the new features added in servletrequest interface i.e. Servlet 2.4

573


How is a servlet implemented in code?

566


Write a simple servlet program to print the contents of html.

551


How can I send user authentication information while making URL Connection?

545


Explain the role of dispatcherservlet and contextloaderlistener.

605






Explain servlet events?

563


Is servlet a controller?

573


What is servlet collaboration?

661


What if we pass negative value in load-on-startup?

805


What are the steps that are required to handle the multi-threading?

597


What is a servlet?

608


What are life cycle methods of a servlet?

588


Difference between doget and dopost?

682


Why do we have servlet filters?

599


What is the difference between Servlet Request and Servlet Context when calling a Request Dispatcher?

600