| Author |
Thread Safety Question?
|
Joe Harry
Ranch Hand
Joined: Sep 26, 2006
Posts: 8795
|
|
The following is also from Javaranch, Which of the following are considered Thread Safe? 1) Local Variables 2) Class Variables 3) Context Variables 4) Request Variables? I choose 1 and 2. Am I right?
|
SCJP 1.4, SCWCD 1.4 - Hints for you, SCBCD Hints - Demnachst, SCDJWS - Auch Demnachst
Did a rm -R / to find out that I lost my entire Linux installation!
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14672
|
|
No. 1 and 4. Only method local variables and request variables are thread safe. I don't like the "Class Variables" thing What class is this ? The servlet class ?
|
[My Blog]
All roads lead to JavaRanch
|
 |
Sagar kanchi
Ranch Hand
Joined: Oct 07, 2005
Posts: 50
|
|
|
I think Class variables are static varibles and class refers to Servlet class itself.
|
Where there are more wonders there is less knowledge
|
 |
Joe Harry
Ranch Hand
Joined: Sep 26, 2006
Posts: 8795
|
|
|
Yes, class variables are static servlet variables in the question's context!
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14672
|
|
class variables are static servlet variables
Not thread safe then.
|
 |
 |
|
|
subject: Thread Safety Question?
|
|
|