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

Comparing jsr166/src/main/java/util/concurrent/ForkJoinTask.java (file contents):
Revision 1.9 by jsr166, Wed Aug 5 01:52:34 2009 UTC vs.
Revision 1.10 by jsr166, Wed Aug 12 04:10:59 2009 UTC

# Line 78 | Line 78 | import java.util.WeakHashMap;
78   * <p>The execution status of tasks may be queried at several levels
79   * of detail: {@link #isDone} is true if a task completed in any way
80   * (including the case where a task was cancelled without executing);
81 * {@link #isCancelled} is true if completion was due to cancellation;
81   * {@link #isCompletedNormally} is true if a task completed without
82 < * cancellation or encountering an exception; {@link
83 < * #isCompletedExceptionally} is true if if the task encountered an
84 < * exception (in which case {@link #getException} returns the
85 < * exception); {@link #isCancelled} is true if the task was cancelled
86 < * (in which case {@link #getException} returns a {@link
87 < * java.util.concurrent.CancellationException}); and {@link
88 < * #isCompletedAbnormally} is true if a task was either cancelled or
90 < * encountered an exception.
82 > * cancellation or encountering an exception; {@link #isCancelled} is
83 > * true if the task was cancelled (in which case {@link #getException}
84 > * returns a {@link java.util.concurrent.CancellationException}); and
85 > * {@link #isCompletedAbnormally} is true if a task was either
86 > * cancelled or encountered an exception, in which case {@link
87 > * #getException} will return either the encountered exception or
88 > * {@link java.util.concurrent.CancellationException}.
89   *
90   * <p>The ForkJoinTask class is not usually directly subclassed.
91   * Instead, you subclass one of the abstract classes that support a
# Line 527 | Line 525 | public abstract class ForkJoinTask<V> im
525      }
526  
527      /**
528 <     * Returns the result of the computation when it is ready.
528 >     * Returns the result of the computation when it {@link #isDone is done}.
529       * This method differs from {@link #get()} in that
530       * abnormal completion results in {@code RuntimeException} or
531       * {@code Error}, not {@code ExecutionException}.
# Line 724 | Line 722 | public abstract class ForkJoinTask<V> im
722          return (status & COMPLETION_MASK) == CANCELLED;
723      }
724  
727    /**
728     * Returns {@code true} if the computation performed by this task
729     * has completed (or has been cancelled).
730     *
731     * @return {@code true} if this computation has completed
732     */
725      public final boolean isDone() {
726          return status < 0;
727      }
728  
737    /**
738     * Returns {@code true} if this task was cancelled.
739     *
740     * @return {@code true} if this task was cancelled
741     */
729      public final boolean isCancelled() {
730          return (status & COMPLETION_MASK) == CANCELLED;
731      }
# Line 764 | Line 751 | public abstract class ForkJoinTask<V> im
751      }
752  
753      /**
767     * Returns {@code true} if this task threw an exception.
768     *
769     * @return {@code true} if this task threw an exception
770     */
771    public final boolean isCompletedExceptionally() {
772        return (status & COMPLETION_MASK) == EXCEPTIONAL;
773    }
774
775    /**
754       * Returns the exception thrown by the base computation, or a
755       * {@code CancellationException} if cancelled, or {@code null} if
756       * none or if the method has not yet completed.
# Line 845 | Line 823 | public abstract class ForkJoinTask<V> im
823      }
824  
825      /**
826 <     * Possibly executes other tasks until this task is ready, then
827 <     * returns the result of the computation.  This method may be more
828 <     * efficient than {@code join}, but is only applicable when
829 <     * there are no potential dependencies between continuation of the
830 <     * current task and that of any other task that might be executed
831 <     * while helping. (This usually holds for pure divide-and-conquer
832 <     * tasks).
826 >     * Possibly executes other tasks until this task {@link #isDone is
827 >     * done}, then returns the result of the computation.  This method
828 >     * may be more efficient than {@code join}, but is only applicable
829 >     * when there are no potential dependencies between continuation
830 >     * of the current task and that of any other task that might be
831 >     * executed while helping. (This usually holds for pure
832 >     * divide-and-conquer tasks).
833       *
834       * <p>This method may be invoked only from within {@code
835       * ForkJoinTask} computations (as may be determined using method
# Line 869 | Line 847 | public abstract class ForkJoinTask<V> im
847      }
848  
849      /**
850 <     * Possibly executes other tasks until this task is ready.  This
851 <     * method may be useful when processing collections of tasks when
852 <     * some have been cancelled or otherwise known to have aborted.
850 >     * Possibly executes other tasks until this task {@link #isDone is
851 >     * done}.  This method may be useful when processing collections
852 >     * of tasks when some have been cancelled or otherwise known to
853 >     * have aborted.
854       *
855       * <p>This method may be invoked only from within {@code
856       * ForkJoinTask} computations (as may be determined using method

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines