25 |
|
* <p> A "main" ForkJoinTask begins execution when submitted to a |
26 |
|
* {@link ForkJoinPool}. Once started, it will usually in turn start |
27 |
|
* other subtasks. As indicated by the name of this class, many |
28 |
< |
* programs using ForkJoinTasks employ only methods {@code fork} |
29 |
< |
* and {@code join}, or derivatives such as |
30 |
< |
* {@code invokeAll}. However, this class also provides a number |
31 |
< |
* of other methods that can come into play in advanced usages, as |
32 |
< |
* well as extension mechanics that allow support of new forms of |
33 |
< |
* fork/join processing. |
28 |
> |
* programs using ForkJoinTasks employ only methods {@code fork} and |
29 |
> |
* {@code join}, or derivatives such as {@code invokeAll}. However, |
30 |
> |
* this class also provides a number of other methods that can come |
31 |
> |
* into play in advanced usages, as well as extension mechanics that |
32 |
> |
* allow support of new forms of fork/join processing. |
33 |
|
* |
34 |
|
* <p>A ForkJoinTask is a lightweight form of {@link Future}. The |
35 |
|
* efficiency of ForkJoinTasks stems from a set of restrictions (that |
93 |
|
* lightweight task scheduling framework, and so cannot be overridden. |
94 |
|
* Developers creating new basic styles of fork/join processing should |
95 |
|
* minimally implement {@code protected} methods |
96 |
< |
* {@code exec}, {@code setRawResult}, and |
97 |
< |
* {@code getRawResult}, while also introducing an abstract |
96 |
> |
* {@link #exec}, {@link #setRawResult}, and |
97 |
> |
* {@link #getRawResult}, while also introducing an abstract |
98 |
|
* computational method that can be implemented in its subclasses, |
99 |
|
* possibly relying on other {@code protected} methods provided |
100 |
|
* by this class. |
672 |
|
/** |
673 |
|
* Asserts that the results of this task's computation will not be |
674 |
|
* used. If a cancellation occurs before attempting to execute this |
675 |
< |
* task, then execution will be suppressed, {@code isCancelled} |
676 |
< |
* will report true, and {@code join} will result in a |
675 |
> |
* task, execution will be suppressed, {@link #isCancelled} |
676 |
> |
* will report true, and {@link #join} will result in a |
677 |
|
* {@code CancellationException} being thrown. Otherwise, when |
678 |
|
* cancellation races with completion, there are no guarantees |
679 |
< |
* about whether {@code isCancelled} will report true, whether |
680 |
< |
* {@code join} will return normally or via an exception, or |
681 |
< |
* whether these behaviors will remain consistent upon repeated |
679 |
> |
* about whether {@code isCancelled} will report {@code true}, |
680 |
> |
* whether {@code join} will return normally or via an exception, |
681 |
> |
* or whether these behaviors will remain consistent upon repeated |
682 |
|
* invocation. |
683 |
|
* |
684 |
|
* <p>This method may be overridden in subclasses, but if so, must |
688 |
|
* <p> This method is designed to be invoked by <em>other</em> |
689 |
|
* tasks. To terminate the current task, you can just return or |
690 |
|
* throw an unchecked exception from its computation method, or |
691 |
< |
* invoke {@code completeExceptionally}. |
691 |
> |
* invoke {@link #completeExceptionally}. |
692 |
|
* |
693 |
|
* @param mayInterruptIfRunning this value is ignored in the |
694 |
|
* default implementation because tasks are not in general |