Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

another easy question

 
David Liu
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Implementing the SingleThreadModel interface doesn't ensure that the servlet is threadsafe"
is it right?
 
AJAY RANA
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes this is true.
Implementing SingleThreadModelInterface ensures that no 2 threads would access ur service method simultaneously,
BUT
--The attributes in session and application scopes are accessible from other threads also.
--Class variables NOT thread safe(same copy goes to multiple instances if container creates multiple instances in SingleThreadModel interface).
Ajay Rana
SCJP,SCWCD
 
David Liu
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
RANA
thank you very much
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic