David Detlefs - Sun Microsystems Labs BOS wrote:
[snip]
> Does this seem right? I asked a pretty knowledgeable colleague about
> this, and his take was completely different: that "thread-local" in
> the JMM's usage meant "thread-local for the object's entire lifetime",
> not the "thread-local at a given program point" that I had taken.
>
Your colleague was right. When we said "thread-local", we meant
"Thread-local for the entire lifetime of the object".
This object isn't thread-local, because it escapes the thread (eventually).
Having said that, in this particular case, you can remove some of the
synchronization in the manner you suggested. In effect, you turn
Bar.bbb into a volatile. You have to be careful with that, of course.
Jeremy
-------------------------------
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel
This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:01:09 EDT