[concurrency-interest] Basic thread safety question: final/volatile/synchronized fields

Timo Nentwig tnentwig at verisign.com
Fri Dec 22 07:44:48 EST 2006

Joe Bowbeer wrote:
> Objects that are not changed after they are constructed come in two
> flavors: those that can't be changed (aka immutable) and those that
> could be changed but aren't (aka "effectively immutable").
> Safe publication means transmitting the object to another thread by
> means of a shared lock or volatile (that is, a "happens before"
> relationship).
> Passing an object through a thread-safe queue is a common means of
> safe publication.

Sorry, I'm not sure whether I understood this properly: The "effectively
mutable" case actually is thread-safe or is explicitly neccessary that a
field is declared final to be thread-safe (and if so why is it)?

More information about the Concurrency-interest mailing list