• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SingleThreadModel

 
Vishnu Prakash
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From Spec:

For a servlet implementing the SingleThreadModel interface, the servlet container may instantiate multiple instances to handle a heavy request load and serialize requests to a particular instance.

What does this mean


and serialize requests to a particular instance.
 
Sravan Kumar
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It means what it says!

Servlets implementing SingleThreadModel cannot be run on two threads at the same time. So, if there are mutiple requests, the servlet container will create a pool of instances for this servlet and dispatch each request to a different instance.

Note that SingleThreadModel has been deprecated in Servlet Spec 2.4 and programmers are strictly advised not to use this. Though SingleThreadModel seems lucrative for solving mutil-threading problems, it actually does not !!
 
Vishnu Prakash
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello

Your answer doesn't seem to answer my Question.
 
Sravan Kumar
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It means it will dispatch every new request to separate instances.
 
Vishnu Prakash
Ranch Hand
Posts: 1026
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic