File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Servlets
Bookmark "Which Attribute Scopes Are Thread-Safe?" Watch "Which Attribute Scopes Are Thread-Safe?" New topic

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
I agree. Here's the link:
subject: Which Attribute Scopes Are Thread-Safe?
jQuery in Action, 3rd edition