ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/jsr166e/extra/AtomicDouble.java
(Generate patch)

Comparing jsr166/src/jsr166e/extra/AtomicDouble.java (file contents):
Revision 1.13 by jsr166, Tue Oct 25 20:30:26 2011 UTC vs.
Revision 1.14 by jsr166, Wed Jan 9 02:51:37 2013 UTC

# Line 253 | Line 253 | public class AtomicDouble extends Number
253      private static sun.misc.Unsafe getUnsafe() {
254          try {
255              return sun.misc.Unsafe.getUnsafe();
256 <        } catch (SecurityException se) {
257 <            try {
258 <                return java.security.AccessController.doPrivileged
259 <                    (new java.security
260 <                     .PrivilegedExceptionAction<sun.misc.Unsafe>() {
261 <                        public sun.misc.Unsafe run() throws Exception {
262 <                            java.lang.reflect.Field f = sun.misc
263 <                                .Unsafe.class.getDeclaredField("theUnsafe");
264 <                            f.setAccessible(true);
265 <                            return (sun.misc.Unsafe) f.get(null);
266 <                        }});
267 <            } catch (java.security.PrivilegedActionException e) {
268 <                throw new RuntimeException("Could not initialize intrinsics",
269 <                                           e.getCause());
270 <            }
256 >        } catch (SecurityException tryReflectionInstead) {}
257 >        try {
258 >            return java.security.AccessController.doPrivileged
259 >            (new java.security.PrivilegedExceptionAction<sun.misc.Unsafe>() {
260 >                public sun.misc.Unsafe run() throws Exception {
261 >                    Class<sun.misc.Unsafe> k = sun.misc.Unsafe.class;
262 >                    for (java.lang.reflect.Field f : k.getDeclaredFields()) {
263 >                        f.setAccessible(true);
264 >                        Object x = f.get(null);
265 >                        if (k.isInstance(x))
266 >                            return k.cast(x);
267 >                    }
268 >                    throw new NoSuchFieldError("the Unsafe");
269 >                }});
270 >        } catch (java.security.PrivilegedActionException e) {
271 >            throw new RuntimeException("Could not initialize intrinsics",
272 >                                       e.getCause());
273          }
274      }
275   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines