--- jsr166/src/jsr166y/ForkJoinTask.java 2010/09/17 14:24:56 1.62 +++ jsr166/src/jsr166y/ForkJoinTask.java 2010/10/16 16:37:30 1.65 @@ -7,7 +7,6 @@ package jsr166y; import java.util.concurrent.*; - import java.io.Serializable; import java.util.Collection; import java.util.Collections; @@ -262,7 +261,7 @@ public abstract class ForkJoinTask im int s; while ((s = status) >= 0) { synchronized (this) { - if (UNSAFE.compareAndSwapInt(this, statusOffset, s, SIGNAL)){ + if (UNSAFE.compareAndSwapInt(this, statusOffset, s, SIGNAL)) { boolean interrupted = false; while (status >= 0) { try { @@ -643,7 +642,15 @@ public abstract class ForkJoinTask im } /** - * @throws CancellationException {@inheritDoc} + * Waits if necessary for the computation to complete, and then + * retrieves its result. + * + * @return the computed result + * @throws CancellationException if the computation was cancelled + * @throws ExecutionException if the computation threw an + * exception + * @throws InterruptedException if the current thread is not a + * member of a ForkJoinPool and was interrupted while waiting */ public final V get() throws InterruptedException, ExecutionException { int s; @@ -654,7 +661,7 @@ public abstract class ForkJoinTask im else { while ((s = status) >= 0) { synchronized (this) { // interruptible form of awaitDone - if (UNSAFE.compareAndSwapInt(this, statusOffset, + if (UNSAFE.compareAndSwapInt(this, statusOffset, s, SIGNAL)) { while (status >= 0) wait(); @@ -673,7 +680,18 @@ public abstract class ForkJoinTask im } /** - * @throws CancellationException {@inheritDoc} + * Waits if necessary for at most the given time for the computation + * to complete, and then retrieves its result, if available. + * + * @param timeout the maximum time to wait + * @param unit the time unit of the timeout argument + * @return the computed result + * @throws CancellationException if the computation was cancelled + * @throws ExecutionException if the computation threw an + * exception + * @throws InterruptedException if the current thread is not a + * member of a ForkJoinPool and was interrupted while waiting + * @throws TimeoutException if the wait timed out */ public final V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {