RFR: 8172048: Re-examine use of AtomicReference in java.security.Policy

Claes Redestad claes.redestad at oracle.com
Tue Dec 27 14:04:45 UTC 2016


since java.util.concurrent.AtomicReference was changed to use a
VarHandle internally, using it from within the security libraries can
lead to hard to diagnose bootstrap cycles (since VarHandles has to do
doPrivileged calls during setup). The need to initialize VarHandles is
also cause for a small startup regression for any application run with
a security manager.

The use of AtomicReference in java.security.Policy is not really
motivated, though, since only the .get/.set methods are used, thus a
rather straight-forward fix is to convert the code to use a volatile
reference instead with identical semantics:

Bug: https://bugs.openjdk.java.net/browse/JDK-8172048
Webrev: http://cr.openjdk.java.net/~redestad/8172048/webrev.01/

While a rather insignificant startup improvement in and off itself,
this would help to unblock the attempted fix to resolve



More information about the core-libs-dev mailing list