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 |
388 |
|
* Creates a new CountedCompleter with the given completer |
389 |
|
* and initial pending count. |
390 |
|
* |
391 |
< |
* @param completer this tasks completer, or {@code null} if none |
391 |
> |
* @param completer this task's completer, or {@code null} if none |
392 |
|
* @param initialPendingCount the initial pending count |
393 |
|
*/ |
394 |
|
protected CountedCompleter(CountedCompleter<?> completer, |
401 |
|
* Creates a new CountedCompleter with the given completer |
402 |
|
* and an initial pending count of zero. |
403 |
|
* |
404 |
< |
* @param completer this tasks completer, or {@code null} if none |
404 |
> |
* @param completer this task's completer, or {@code null} if none |
405 |
|
*/ |
406 |
|
protected CountedCompleter(CountedCompleter<?> completer) { |
407 |
|
this.completer = completer; |
422 |
|
|
423 |
|
/** |
424 |
|
* Performs an action when method {@link #tryComplete} is invoked |
425 |
< |
* and there are no pending counts, or when the unconditional |
425 |
> |
* and the pending count is zero, or when the unconditional |
426 |
|
* method {@link #complete} is invoked. By default, this method |
427 |
|
* does nothing. You can distinguish cases by checking the |
428 |
|
* identity of the given caller argument. If not equal to {@code |
450 |
|
* @param caller the task invoking this method (which may |
451 |
|
* be this task itself). |
452 |
|
* @return true if this exception should be propagated to this |
453 |
< |
* tasks completer, if one exists. |
453 |
> |
* task's completer, if one exists. |
454 |
|
*/ |
455 |
|
public boolean onExceptionalCompletion(Throwable ex, CountedCompleter<?> caller) { |
456 |
|
return true; |