> From: Chema [mailto:demablo...@gmail.com] 
> Subject: Re: Babysitting ThreadLocals

> Do you mean that read operations (getters) in not-threadsafe objects
> are not an atomic operations and could retrieve "dirty" values cause
> sharing across threads?

Correct.  Not-thread-safe means just what it sounds like.

> So, singleton objects must be threadsafe to be a rea singleton ?

Depends on the object.  If you have written the class code to insure that 
ostensibly read-only operations do not mutate the object in any way, then you 
only need to provide synchronization when there's a risk of a non-read-only 
operation being active.  If you didn't write the code, you have no guarantee 
that non-thread-safe getter methods don't mutate the object internally during 
their processing.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to