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

Whats the advantages using servlets over using CGI?

824


How do you design microservices?

836


What are the phases of the servlet life cycle?

830


Does servlet have main method?

926


What do you mean by cgi in servlet?

826


Name the different ways of session tracking.

785


What is the difference between forward () and sendredirect () functions in servlet? Explain

776


Difference between get and post in java servlets?

778


What is webservlet?

755


What are the life cycle methods of a servlet?

797


Explain the difference between a web server and a web container?

752


Write a servlet to upload file on server.

835


How do you run a servlet?

797


What is the servletconfig object?

772


How do cookies work in servlets?

813