• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SingleThreadModel or MultiThreadModel?

 
NDP Prasad
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to know which one is the best SingleThreadedModel or MultiThreadedModel?

 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
MultiThreadedModel ? What is this ?

About SingleThreadModel, it is deprectaed, so it is not recommended to use it. Here is an abstract from the spec :


The use of the SingleThreadModel interface guarantees that only one thread at a time will execute in a given servlet instance�s service method. It is important to note that this guarantee only applies to each servlet instance, since the container may choose to pool such objects. Objects that are accessible to more than one servlet instance at a time, such as instances of HttpSession, may be available at any particular time to multiple servlets, including those that implement SingleThreadModel.
It is recommended that a developer take other means to resolve those issues instead of implementing this interface, such as avoiding the usage of an instance variable or synchronizing the block of the code accessing those resources. The SingleThreadModel Interface is deprecated in this version of the specification.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic