aspose file tools*
The moose likes Servlets and the fly likes In what situation it will be helpful to use Servlet with SingleThreadModel. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "In what situation it will be helpful to use Servlet with SingleThreadModel." Watch "In what situation it will be helpful to use Servlet with SingleThreadModel." New topic
Author

In what situation it will be helpful to use Servlet with SingleThreadModel.

Deepti Lalwani
Greenhorn

Joined: Sep 20, 2011
Posts: 1

Can anyone help me understanding SingleThreadModel , I know it ensures that servlet handle only one request at a time and guarantees that no two threads will execute concurrently in the servlet's service method, but what will be the situation where we should use SingleThreadModel, I mean we can use plain java class using webservice.

In what situation it will be helpful and beneficial to use servlet with SingleThreadModel.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12825
    
    5
Short answer - NEVER


The original Servlet API included SingleThreadModel because web servers were a relatively new technology for Java developers and the designers thought that having STM might help people get started. As people have come to understand the web server environment they have realized that STM is not necessary and just causes complications.

Similar thinking brought us the "Invoker" servlet which has caused so much trouble.

We live and learn.

Bill
 
 
subject: In what situation it will be helpful to use Servlet with SingleThreadModel.