Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Deepti Lalwani
Greenhorn
Posts: 1
Java Java ME Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13074
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic