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

Brian Goetz brian at quiotix.com
Wed Dec 20 17:48:34 EST 2006


> Ah, good point.  An external class can provide the thread safety
> (client-side locking I think was the JCiP term?).

In this case it would be called confinement -- the Foo is confined in 
the Moo, and Moo provides the right synchronization.

> But, good to know I understand correctly.  The reason I questioned
> myself was that I've seen precious few thread safe classes. I've rarely,
> if ever, seen much attention paid to making sure each instance field is
> properly protected.  A few assessors might be synchronized, but the
> thread-safety considerations are ad-hoc at best.

Sadly, yes.


More information about the Concurrency-interest mailing list