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

What are the differences between servlet context vs servlet config?

570


What’s the difference between genericservlet and httpservlet?

519


What is called servlet container?

653


What do you mean by session tracking and also explain its techniques?

488


The code in a finally clause will never fail to execute, right?

591






What is meant by servlet? What are the parameters of the service method?

564


how many jsp scripting elements are there and what are those?

536


How can we refresh automatically when new data is entered into the database?

587


What are the steps that are involved in using the httpservlet class?

563


How to generate the server side programming and the advantages of it over the other languages?

550


Which application server is best for java?

548


Difference between doget and dopost?

672


How can the session in servlet be destroyed?

633


What do you mean by cgi in servlet?

622


Why is servlet used?

671