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

Comparing jsr166/src/jsr166y/CountedCompleter.java (file contents):
Revision 1.23 by jsr166, Sun Nov 25 21:04:43 2012 UTC vs.
Revision 1.26 by jsr166, Mon Nov 26 12:08:49 2012 UTC

# Line 15 | Line 15 | package jsr166y;
15   * CountedCompleter are similar to those of other completion based
16   * components (such as {@link java.nio.channels.CompletionHandler})
17   * except that multiple <em>pending</em> completions may be necessary
18 < * to trigger the {@link #onCompletion} action, not just one. Unless
19 < * initialized otherwise, the {@link #getPendingCount pending count}
20 < * starts at zero, but may be (atomically) changed using methods
21 < * {@link #setPendingCount}, {@link #addToPendingCount}, and {@link
22 < * #compareAndSetPendingCount}. Upon invocation of {@link
18 > * to trigger the completion action {@link #onCompletion}, not just one.
19 > * Unless initialized otherwise, the {@linkplain #getPendingCount pending
20 > * count} starts at zero, but may be (atomically) changed using
21 > * methods {@link #setPendingCount}, {@link #addToPendingCount}, and
22 > * {@link #compareAndSetPendingCount}. Upon invocation of {@link
23   * #tryComplete}, if the pending action count is nonzero, it is
24   * decremented; otherwise, the completion action is performed, and if
25   * this completer itself has a completer, the process is continued
# Line 183 | Line 183 | package jsr166y;
183   *
184   * <p><b>Searching.</b> A tree of CountedCompleters can search for a
185   * value or property in different parts of a data structure, and
186 < * report a result in an {@link java.util.concurrent.AtomicReference}
187 < * as soon as one is found. The others can poll the result to avoid
188 < * unnecessary work. (You could additionally {@link #cancel} other
189 < * tasks, but it is usually simpler and more efficient to just let
190 < * them notice that the result is set and if so skip further
191 < * processing.)  Illustrating again with an array using full
186 > * report a result in an {@link
187 > * java.util.concurrent.atomic.AtomicReference AtomicReference} as
188 > * soon as one is found. The others can poll the result to avoid
189 > * unnecessary work. (You could additionally {@linkplain #cancel
190 > * cancel} other tasks, but it is usually simpler and more efficient
191 > * to just let them notice that the result is set and if so skip
192 > * further processing.)  Illustrating again with an array using full
193   * partitioning (again, in practice, leaf tasks will almost always
194   * process more than one element):
195   *
# Line 388 | Line 389 | public abstract class CountedCompleter<T
389       * Creates a new CountedCompleter with the given completer
390       * and initial pending count.
391       *
392 <     * @param completer this tasks completer, or {@code null} if none
392 >     * @param completer this task's completer, or {@code null} if none
393       * @param initialPendingCount the initial pending count
394       */
395      protected CountedCompleter(CountedCompleter<?> completer,
# Line 401 | Line 402 | public abstract class CountedCompleter<T
402       * Creates a new CountedCompleter with the given completer
403       * and an initial pending count of zero.
404       *
405 <     * @param completer this tasks completer, or {@code null} if none
405 >     * @param completer this task's completer, or {@code null} if none
406       */
407      protected CountedCompleter(CountedCompleter<?> completer) {
408          this.completer = completer;
# Line 422 | Line 423 | public abstract class CountedCompleter<T
423  
424      /**
425       * Performs an action when method {@link #tryComplete} is invoked
426 <     * and there are no pending counts, or when the unconditional
426 >     * and the pending count is zero, or when the unconditional
427       * method {@link #complete} is invoked.  By default, this method
428       * does nothing. You can distinguish cases by checking the
429       * identity of the given caller argument. If not equal to {@code
# Line 450 | Line 451 | public abstract class CountedCompleter<T
451       * @param caller the task invoking this method (which may
452       * be this task itself).
453       * @return true if this exception should be propagated to this
454 <     * tasks completer, if one exists.
454 >     * task's completer, if one exists.
455       */
456      public boolean onExceptionalCompletion(Throwable ex, CountedCompleter<?> caller) {
457          return true;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines