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

Comparing jsr166/src/jsr166e/ForkJoinTask.java (file contents):
Revision 1.9 by dl, Tue Jan 1 15:10:32 2013 UTC vs.
Revision 1.12 by jsr166, Tue Feb 5 17:09:54 2013 UTC

# Line 134 | Line 134 | import java.lang.reflect.Constructor;
134   * (DAG). Otherwise, executions may encounter a form of deadlock as
135   * tasks cyclically wait for each other.  However, this framework
136   * supports other methods and techniques (for example the use of
137 < * {@link Phaser}, {@link #helpQuiesce}, and {@link #complete}) that
137 > * {@link java.util.concurrent.Phaser}, {@link #helpQuiesce}, and
138 > * {@link #complete}) that
139   * may be of use in constructing custom subclasses for problems that
140   * are not statically structured as DAGs. To support such usages a
141   * ForkJoinTask may be atomically <em>tagged</em> with a {@code short}
# Line 468 | Line 469 | public abstract class ForkJoinTask<V> im
469      }
470  
471      /**
472 <     * Removes exception node and clears status
472 >     * Removes exception node and clears status.
473       */
474      private void clearExceptionalCompletion() {
475          int h = System.identityHashCode(this);
# Line 1485 | Line 1486 | public abstract class ForkJoinTask<V> im
1486      private static sun.misc.Unsafe getUnsafe() {
1487          try {
1488              return sun.misc.Unsafe.getUnsafe();
1489 <        } catch (SecurityException se) {
1490 <            try {
1491 <                return java.security.AccessController.doPrivileged
1492 <                    (new java.security
1493 <                     .PrivilegedExceptionAction<sun.misc.Unsafe>() {
1494 <                        public sun.misc.Unsafe run() throws Exception {
1495 <                            java.lang.reflect.Field f = sun.misc
1496 <                                .Unsafe.class.getDeclaredField("theUnsafe");
1497 <                            f.setAccessible(true);
1498 <                            return (sun.misc.Unsafe) f.get(null);
1499 <                        }});
1500 <            } catch (java.security.PrivilegedActionException e) {
1501 <                throw new RuntimeException("Could not initialize intrinsics",
1502 <                                           e.getCause());
1503 <            }
1489 >        } catch (SecurityException tryReflectionInstead) {}
1490 >        try {
1491 >            return java.security.AccessController.doPrivileged
1492 >            (new java.security.PrivilegedExceptionAction<sun.misc.Unsafe>() {
1493 >                public sun.misc.Unsafe run() throws Exception {
1494 >                    Class<sun.misc.Unsafe> k = sun.misc.Unsafe.class;
1495 >                    for (java.lang.reflect.Field f : k.getDeclaredFields()) {
1496 >                        f.setAccessible(true);
1497 >                        Object x = f.get(null);
1498 >                        if (k.isInstance(x))
1499 >                            return k.cast(x);
1500 >                    }
1501 >                    throw new NoSuchFieldError("the Unsafe");
1502 >                }});
1503 >        } catch (java.security.PrivilegedActionException e) {
1504 >            throw new RuntimeException("Could not initialize intrinsics",
1505 >                                       e.getCause());
1506          }
1507      }
1505
1508   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines