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
Author and all-around good cowpoke
Joined: Mar 22, 2000
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.