Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How Servlet Requests are handled by Webserver internallly

 
satishbsk kumar
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
Please clarify whether Server creates new thread(Servlet Instance) for each request.

Rgds,
Satish
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unless you implement the SingleThreadModel, the container creates a new Thread for each incoming request. Note however that it does not create a new servlet instance, it works on the same unless you have different mappings for one servlet.
So watch out for thread safety.

BTW.. SingleThreadModel is deprecated and should not be used.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, in the interests of completeness, a "new thread" and "new servlet instance" are not the same thing.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic