If an object is referenced by a local variable -- is it safe from concurrency issues?!_NEWLINE_!
Posted By:
Alex_Chaffee
Posted On:
Monday, April 30, 2001 04:47 PM
No. The local variable only holds a pointer to an object; if other threads can also point to this object, then it needs to be made thread-safe.
Re: Multithreading Servlets, local vars, and !_NEWLINE_!utility classes
Posted By:
Michael_Wax
Posted On:
Sunday, April 8, 2001 01:19 PM
If your servlet were creating an instance of a class, then that instance would be thread-safe. However, if I understand your question correctly, your servlet is getting an instance of an entity EJB. In that case, all of the servlets are sharing the same object, so that more than one could be modifying instance variables in the object at the same time, i.e., you are not safe from concurrency issues.