--- jsr166/src/jsr166y/ForkJoinTask.java 2012/11/19 18:12:42 1.94
+++ jsr166/src/jsr166y/ForkJoinTask.java 2013/01/01 15:10:39 1.98
@@ -55,7 +55,7 @@ import java.lang.reflect.Constructor;
* minimize other blocking synchronization apart from joining other
* tasks or using synchronizers such as Phasers that are advertised to
* cooperate with fork/join scheduling. Subdividable tasks should also
- * not perform blocking IO, and should ideally access variables that
+ * not perform blocking I/O, and should ideally access variables that
* are completely independent of those accessed by other running
* tasks. These guidelines are loosely enforced by not permitting
* checked exceptions such as {@code IOExceptions} to be
@@ -73,7 +73,7 @@ import java.lang.reflect.Constructor;
*
It is possible to define and use ForkJoinTasks that may block,
* but doing do requires three further considerations: (1) Completion
* of few if any other tasks should be dependent on a task
- * that blocks on external synchronization or IO. Event-style async
+ * that blocks on external synchronization or I/O. Event-style async
* tasks that are never joined (for example, those subclassing {@link
* CountedCompleter}) often fall into this category. (2) To minimize
* resource impact, tasks should be small; ideally performing only the
@@ -435,7 +435,7 @@ public abstract class ForkJoinTask im
}
/**
- * Records exception and possibly propagates
+ * Records exception and possibly propagates.
*
* @return status on exit
*/
@@ -606,7 +606,7 @@ public abstract class ForkJoinTask im
throw (Error)ex;
if (ex instanceof RuntimeException)
throw (RuntimeException)ex;
- throw uncheckedThrowable(ex, RuntimeException.class);
+ ForkJoinTask.uncheckedThrow(ex);
}
}
@@ -616,8 +616,9 @@ public abstract class ForkJoinTask im
* unchecked exceptions
*/
@SuppressWarnings("unchecked") static
- T uncheckedThrowable(final Throwable t, final Class c) {
- return (T)t; // rely on vacuous cast
+ void uncheckedThrow(Throwable t) throws T {
+ if (t != null)
+ throw (T)t; // rely on vacuous cast
}
/**
@@ -652,7 +653,7 @@ public abstract class ForkJoinTask im
if ((t = Thread.currentThread()) instanceof ForkJoinWorkerThread)
((ForkJoinWorkerThread)t).workQueue.push(this);
else
- ForkJoinPool.commonPool.externalPush(this);
+ ForkJoinPool.common.externalPush(this);
return this;
}
@@ -978,8 +979,9 @@ public abstract class ForkJoinTask im
if (Thread.interrupted())
throw new InterruptedException();
// Messy in part because we measure in nanosecs, but wait in millisecs
- int s; long ns, ms;
- if ((s = status) >= 0 && (ns = unit.toNanos(timeout)) > 0L) {
+ int s; long ms;
+ long ns = unit.toNanos(timeout);
+ if ((s = status) >= 0 && ns > 0L) {
long deadline = System.nanoTime() + ns;
ForkJoinPool p = null;
ForkJoinPool.WorkQueue w = null;
@@ -1075,7 +1077,7 @@ public abstract class ForkJoinTask im
wt.pool.helpQuiescePool(wt.workQueue);
}
else
- ForkJoinPool.externalHelpQuiescePool();
+ ForkJoinPool.quiesceCommonPool();
}
/**
@@ -1500,4 +1502,5 @@ public abstract class ForkJoinTask im
}
}
}
+
}