• Post Reply Bookmark Topic Watch Topic
  • New Topic

Instance variables and multi-threading

 
Paulus Maessen
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have a question about the example in the SCWCD exam study kit:

On page 165, listing 10.7 shows a servlet that uses an instance variable to cache a database connection. As I understand it this is not threadsafe.

Right?
 
Chengwei Lee
Ranch Hand
Posts: 884
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yep, instance variables are *never* threadsafe.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!