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

Comparing jsr166/src/jsr166y/ForkJoinTask.java (file contents):
Revision 1.95 by jsr166, Mon Nov 26 14:11:54 2012 UTC vs.
Revision 1.100 by jsr166, Tue Feb 5 17:09:54 2013 UTC

# Line 435 | Line 435 | public abstract class ForkJoinTask<V> im
435      }
436  
437      /**
438 <     * Records exception and possibly propagates
438 >     * Records exception and possibly propagates.
439       *
440       * @return status on exit
441       */
# Line 468 | Line 468 | public abstract class ForkJoinTask<V> im
468      }
469  
470      /**
471 <     * Removes exception node and clears status
471 >     * Removes exception node and clears status.
472       */
473      private void clearExceptionalCompletion() {
474          int h = System.identityHashCode(this);
# Line 606 | Line 606 | public abstract class ForkJoinTask<V> im
606                  throw (Error)ex;
607              if (ex instanceof RuntimeException)
608                  throw (RuntimeException)ex;
609 <            throw uncheckedThrowable(ex, RuntimeException.class);
609 >            ForkJoinTask.<RuntimeException>uncheckedThrow(ex);
610          }
611      }
612  
# Line 616 | Line 616 | public abstract class ForkJoinTask<V> im
616       * unchecked exceptions
617       */
618      @SuppressWarnings("unchecked") static <T extends Throwable>
619 <        T uncheckedThrowable(final Throwable t, final Class<T> c) {
620 <        return (T)t; // rely on vacuous cast
619 >        void uncheckedThrow(Throwable t) throws T {
620 >        if (t != null)
621 >            throw (T)t; // rely on vacuous cast
622      }
623  
624      /**
# Line 652 | Line 653 | public abstract class ForkJoinTask<V> im
653          if ((t = Thread.currentThread()) instanceof ForkJoinWorkerThread)
654              ((ForkJoinWorkerThread)t).workQueue.push(this);
655          else
656 <            ForkJoinPool.commonPool.externalPush(this);
656 >            ForkJoinPool.common.externalPush(this);
657          return this;
658      }
659  
# Line 978 | Line 979 | public abstract class ForkJoinTask<V> im
979          if (Thread.interrupted())
980              throw new InterruptedException();
981          // Messy in part because we measure in nanosecs, but wait in millisecs
982 <        int s; long ns, ms;
983 <        if ((s = status) >= 0 && (ns = unit.toNanos(timeout)) > 0L) {
982 >        int s; long ms;
983 >        long ns = unit.toNanos(timeout);
984 >        if ((s = status) >= 0 && ns > 0L) {
985              long deadline = System.nanoTime() + ns;
986              ForkJoinPool p = null;
987              ForkJoinPool.WorkQueue w = null;
# Line 1075 | Line 1077 | public abstract class ForkJoinTask<V> im
1077              wt.pool.helpQuiescePool(wt.workQueue);
1078          }
1079          else
1080 <            ForkJoinPool.externalHelpQuiescePool();
1080 >            ForkJoinPool.quiesceCommonPool();
1081      }
1082  
1083      /**
# Line 1483 | Line 1485 | public abstract class ForkJoinTask<V> im
1485      private static sun.misc.Unsafe getUnsafe() {
1486          try {
1487              return sun.misc.Unsafe.getUnsafe();
1488 <        } catch (SecurityException se) {
1489 <            try {
1490 <                return java.security.AccessController.doPrivileged
1491 <                    (new java.security
1492 <                     .PrivilegedExceptionAction<sun.misc.Unsafe>() {
1493 <                        public sun.misc.Unsafe run() throws Exception {
1494 <                            java.lang.reflect.Field f = sun.misc
1495 <                                .Unsafe.class.getDeclaredField("theUnsafe");
1496 <                            f.setAccessible(true);
1497 <                            return (sun.misc.Unsafe) f.get(null);
1498 <                        }});
1499 <            } catch (java.security.PrivilegedActionException e) {
1500 <                throw new RuntimeException("Could not initialize intrinsics",
1501 <                                           e.getCause());
1502 <            }
1488 >        } catch (SecurityException tryReflectionInstead) {}
1489 >        try {
1490 >            return java.security.AccessController.doPrivileged
1491 >            (new java.security.PrivilegedExceptionAction<sun.misc.Unsafe>() {
1492 >                public sun.misc.Unsafe run() throws Exception {
1493 >                    Class<sun.misc.Unsafe> k = sun.misc.Unsafe.class;
1494 >                    for (java.lang.reflect.Field f : k.getDeclaredFields()) {
1495 >                        f.setAccessible(true);
1496 >                        Object x = f.get(null);
1497 >                        if (k.isInstance(x))
1498 >                            return k.cast(x);
1499 >                    }
1500 >                    throw new NoSuchFieldError("the Unsafe");
1501 >                }});
1502 >        } catch (java.security.PrivilegedActionException e) {
1503 >            throw new RuntimeException("Could not initialize intrinsics",
1504 >                                       e.getCause());
1505          }
1506      }
1507   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines