• Post Reply Bookmark Topic Watch Topic
  • New Topic

Thread Safe v/s Multiple User

 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Making an application thread safe (only one thread at any time) and enabling an application for multiple user.

Are not these two sentence contradictory?

Thanks.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"thread safe" doesn't mean one thread at a time. A piece of thread safe code can be used by multiple threads concurrently and its behaviour is the same for each thread.
 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Paul.
I got your point.
 
geeta lalchandani
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
wudnt it mean the implementation like singlethreadmodel, an instance is created for different threads?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With SingleThreadModel, a new instance of the servlet is created for each request. Each request is still in it's own thread but separate requests are not sharing instance variables.

By the way:
SingleThreadModel has been deprecated so it's not advisable to use it in new projects.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!