• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Class and instance variables...

 
James Turner
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,

Just for clarification, if a servlet implements the SingleThreadModel interface, are class variables still not thread safe?

Class variables are static variables (just to be sure). Instance variables are not static and not inside the methods.

Regards,

James.
 
sunitha nerevetla
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If Servlet implements SingleThreadModel, instance variables will be thread safe. No matter what, static variables/class variables are never thread safe unless you synchronize them manually.
 
Prasad Pusapati
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sunita,
What You Said Is Correct.But In H&F SCWCD1.4 Book I Came To Know That It "SingleThreadModel" interface is Deprecated.
Thanks,
Prasad Pusapati.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic