• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Synchronization using SingleThread

 
Krishna Srinivasan
Ranch Hand
Posts: 1862
Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is the advantage of using the SingleThreadModel interface rather than using the synchronized keyword before the service method.

Advance Thanx.
 
Gayan Balasooriya
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If your servlet implements the SingleThreadModel interface, servlet container may create several instances of the servlet to process different requests.If you synchronize the service method, all the requests will be processed one by one from a single instance of the servlet.
Gayan Balasooriya
SCJP2,SCWCD
http://www.gayanb.com - Developer Resources
[ September 04, 2003: Message edited by: Gayan Balasooriya ]
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If your design requires either of those techniques, you need to redesign your application to properly make use of the servlet API. In my opinion, SingleThreadModel was a mistake in the first place - it is expected to be deprecated in the near future.
Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic