• 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
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!