| Author |
what r thread safe variables
|
kesava chaitanya
Ranch Hand
Joined: Aug 15, 2001
Posts: 140
|
|
what r thread safe variables and why in the below options? if i write multi threaded servlet which of the variables are threadsafe? 1.request variables 2.session varaibles 3.local variables 4.request,session 5.request,session,local 6.session,local
|
 |
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12271
|
|
1.request variables - The request object is unique to the Thread executing the service and is not shared by any other threads. 2.session variables - Watch out for possible conflicts if your application generates more than one request "at the same time" - for example if you are using frames or generating images. In that case, the same session is in use in multiple requests. 3.local variables - visible only to the Thread executing the method. However, if you assign a reference to a more visible object to a local variable, it is unsafe. ... I don't understand the intent of 4,5,6 Bill
|
Java Resources at www.wbrogden.com
|
 |
Jeroen Wenting
Ranch Hand
Joined: Oct 12, 2000
Posts: 5093
|
|
|
r and i are not threadsafe, are and I maybe.
|
42
|
 |
 |
|
|
subject: what r thread safe variables
|
|
|