• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Static Variable in Servlet

 
Ritesh Raman
Ranch Hand
Posts: 34
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is static variable in servlet Thread safe ? please explain.
 
Joe Harry
Ranch Hand
Posts: 10045
3
Eclipse IDE Mac PPC Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Only local variables are request attributes are thread safe. The rest are all subjected to manipulation by multiple threads unless you synchronize on them.
 
Srinivasan thoyyeti
Ranch Hand
Posts: 557
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Instead of giving the answer I will just guide you

1. what is a Class variable ? how it is different from instance variable ?

2. what thread safety ?

3. By the time you reach point you yourself can judge.

Hope this is good way to learn.
 
Ritesh Raman
Ranch Hand
Posts: 34
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Srinivasan and Jothi for your reply .
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic