--- jsr166/src/jsr166e/ForkJoinPool.java 2013/06/19 16:22:44 1.59 +++ jsr166/src/jsr166e/ForkJoinPool.java 2015/11/05 16:22:39 1.66 @@ -18,7 +18,6 @@ import java.util.concurrent.ExecutorServ import java.util.concurrent.Future; import java.util.concurrent.RejectedExecutionException; import java.util.concurrent.RunnableFuture; -import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.TimeUnit; /** @@ -531,8 +530,8 @@ public class ForkJoinPool extends Abstra * Returns a new worker thread operating in the given pool. * * @param pool the pool this thread works in - * @throws NullPointerException if the pool is null * @return the new worker thread + * @throws NullPointerException if the pool is null */ public ForkJoinWorkerThread newThread(ForkJoinPool pool); } @@ -1534,8 +1533,12 @@ public class ForkJoinPool extends Abstra (m = ws.length - 1) < 0) { // initialize workQueues int p = parallelism; // find power of two table size int n = (p > 1) ? p - 1 : 1; // ensure at least 2 slots - n |= n >>> 1; n |= n >>> 2; n |= n >>> 4; - n |= n >>> 8; n |= n >>> 16; n = (n + 1) << 1; + n |= n >>> 1; + n |= n >>> 2; + n |= n >>> 4; + n |= n >>> 8; + n |= n >>> 16; + n = (n + 1) << 1; WorkQueue[] nws = ((ws = workQueues) == null || ws.length == 0 ? new WorkQueue[n] : null); if (((ps = plock) & PL_LOCK) != 0 || @@ -1840,7 +1843,7 @@ public class ForkJoinPool extends Abstra } } for (;;) { // help stealer or descend to its stealer - ForkJoinTask[] a; int b; + ForkJoinTask[] a; int b; if (subtask.status < 0) // surround probes with continue restart; // consistency checks if ((b = v.base) - v.top < 0 && (a = v.array) != null) { @@ -2097,7 +2100,7 @@ public class ForkJoinPool extends Abstra w.currentSteal = ps; } } - else if (active) { // decrement active count without queuing + else if (active) { // decrement active count without queuing long nc = ((c = ctl) & ~AC_MASK) | ((c & AC_MASK) - AC_UNIT); if ((int)(nc >> AC_SHIFT) + parallelism == 0) break; // bypass decrement-then-increment @@ -2496,6 +2499,7 @@ public class ForkJoinPool extends Abstra * minimally only the latter. * * @param task the task + * @param the type of the task's result * @return the task's result * @throws NullPointerException if the task is null * @throws RejectedExecutionException if the task cannot be @@ -2544,6 +2548,7 @@ public class ForkJoinPool extends Abstra * Submits a ForkJoinTask for execution. * * @param task the task to submit + * @param the type of the task's result * @return the task * @throws NullPointerException if the task is null * @throws RejectedExecutionException if the task cannot be @@ -3282,7 +3287,7 @@ public class ForkJoinPool extends Abstra ForkJoinWorkerThreadFactory factory = defaultForkJoinWorkerThreadFactory; UncaughtExceptionHandler handler = null; - try { // ignore exceptions in accesing/parsing properties + try { // ignore exceptions in accessing/parsing properties String pp = System.getProperty ("java.util.concurrent.ForkJoinPool.common.parallelism"); String fp = System.getProperty