my dog learned polymorphism*
The moose likes Servlets and the fly likes Which Attribute Scopes Are Thread-Safe? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Which Attribute Scopes Are Thread-Safe?" Watch "Which Attribute Scopes Are Thread-Safe?" New topic
Author

Which Attribute Scopes Are Thread-Safe?

JiaPei Jen
Ranch Hand

Joined: Nov 19, 2000
Posts: 1309
Which ones of the following are thread-safe ( with my tempted answers )? Please kindly correct me with reasons.
1. local variable: yes
2. instance variable: no
3. class variable: no
4. request attribute: no
5. session attribute: yes
6. context aattribute: no
Rama Raghavan
Ranch Hand

Joined: Aug 22, 2001
Posts: 116
In my quest for knowledge I think -
If you implement SingleThreadModel then class variable would be thread safe (but not instance variable).


Rama Raghavan<br />SCJP2<br />SCWCD
 
wood burning stoves
 
subject: Which Attribute Scopes Are Thread-Safe?
 
Similar Threads
Static variable
Thread Safe Objects
DSRA9110E Connection is closed
Can Static Variables have multiple copies when in a multi threaded environment and under heavy load?
Regarding Singleton design pattern