What is Single Threaded Model in Servlets? Explain this
with an example?

Answer Posted / devarathnam

Hi... Actually "SingleThreadedModel" is a marker
interface,which doesnot contain any methods.By default
servlet is multithreaded.If u want to make this as single
theaded u can implement this interface in the following
fashion.
public class SingleThreadedTest implements SingleThreadModel
{
//some code
//....
//....
//....
}It is Thread-safety mechanism on a shared resource.

Is This Answer Correct ?    28 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is httpservlet class?

541


Explain the servlet filter.

540


Explain jsessionid and when is it created?

597


What do you mean by httpservlet?

563


What is a web container and what is its responsibility?

531






Why jsp is better than servlet?

530


Describe the phases of servlet lifecycle?

632


Is java servlet still used?

587


What do you mean by scope object and what are its types?

566


Why is http protocol called as a stateless protocol?

535


What is Request Dispatcher?

805


What’s the difference between genericservlet and httpservlet?

532


What exactly are the functions of servlet?

597


What is difference between the HTTP Servlet and Generic Servlet? Explain about their methods and parameters?

613


Given the request path below, which are context path, servlet path and path info?

545