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

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

# Line 300 | Line 300 | public class AtomicDoubleArray implement
300      private static sun.misc.Unsafe getUnsafe() {
301          try {
302              return sun.misc.Unsafe.getUnsafe();
303 <        } catch (SecurityException se) {
304 <            try {
305 <                return java.security.AccessController.doPrivileged
306 <                    (new java.security
307 <                     .PrivilegedExceptionAction<sun.misc.Unsafe>() {
308 <                        public sun.misc.Unsafe run() throws Exception {
309 <                            java.lang.reflect.Field f = sun.misc
310 <                                .Unsafe.class.getDeclaredField("theUnsafe");
311 <                            f.setAccessible(true);
312 <                            return (sun.misc.Unsafe) f.get(null);
313 <                        }});
314 <            } catch (java.security.PrivilegedActionException e) {
315 <                throw new RuntimeException("Could not initialize intrinsics",
316 <                                           e.getCause());
317 <            }
303 >        } catch (SecurityException tryReflectionInstead) {}
304 >        try {
305 >            return java.security.AccessController.doPrivileged
306 >            (new java.security.PrivilegedExceptionAction<sun.misc.Unsafe>() {
307 >                public sun.misc.Unsafe run() throws Exception {
308 >                    Class<sun.misc.Unsafe> k = sun.misc.Unsafe.class;
309 >                    for (java.lang.reflect.Field f : k.getDeclaredFields()) {
310 >                        f.setAccessible(true);
311 >                        Object x = f.get(null);
312 >                        if (k.isInstance(x))
313 >                            return k.cast(x);
314 >                    }
315 >                    throw new NoSuchFieldError("the Unsafe");
316 >                }});
317 >        } catch (java.security.PrivilegedActionException e) {
318 >            throw new RuntimeException("Could not initialize intrinsics",
319 >                                       e.getCause());
320          }
321      }
322   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines