[concurrency-interest] Curious: How Java Memory Model is satisfied in JSR166 locks?

Jason T. Greene jason.greene at redhat.com
Tue Aug 21 09:56:54 EDT 2007

Osvaldo Pinali Doederlein wrote:


> Notice that 
> you cannot invoke Unsafe's methods from your own code, access to that 
> class is restricted to core classes. So you must channel your needs 
> though public APIs like j.u.c locks, atomic objects and base classes 
> like AQS.

Technically there are two ways to get at Unsafe:
1) Put the class that accesses it on the bootclasspath
2) Use reflection to gain access to the Unsafe private static field 
instance (requires a privilege if there is a security manager).

Jason T. Greene
Lead, POJO Cache
JBoss, a division of Red Hat

More information about the Concurrency-interest mailing list