134 |
|
* (DAG). Otherwise, executions may encounter a form of deadlock as |
135 |
|
* tasks cyclically wait for each other. However, this framework |
136 |
|
* supports other methods and techniques (for example the use of |
137 |
< |
* {@link Phaser}, {@link #helpQuiesce}, and {@link #complete}) that |
137 |
> |
* {@link java.util.concurrent.Phaser Phaser}, {@link #helpQuiesce}, and {@link #complete}) that |
138 |
|
* may be of use in constructing custom subclasses for problems that |
139 |
|
* are not statically structured as DAGs. To support such usages, a |
140 |
|
* ForkJoinTask may be atomically <em>tagged</em> with a {@code short} |
782 |
|
* unprocessed. |
783 |
|
* |
784 |
|
* @param tasks the collection of tasks |
785 |
+ |
* @param <T> the type of the values returned from the tasks |
786 |
|
* @return the tasks argument, to simplify usage |
787 |
|
* @throws NullPointerException if tasks or any element are null |
788 |
|
*/ |
1445 |
|
* |
1446 |
|
* @param runnable the runnable action |
1447 |
|
* @param result the result upon completion |
1448 |
+ |
* @param <T> the type of the result |
1449 |
|
* @return the task |
1450 |
|
*/ |
1451 |
|
public static <T> ForkJoinTask<T> adapt(Runnable runnable, T result) { |
1459 |
|
* encountered into {@code RuntimeException}. |
1460 |
|
* |
1461 |
|
* @param callable the callable action |
1462 |
+ |
* @param <T> the type of the callable's result |
1463 |
|
* @return the task |
1464 |
|
*/ |
1465 |
|
public static <T> ForkJoinTask<T> adapt(Callable<? extends T> callable) { |
1473 |
|
/** |
1474 |
|
* Saves this task to a stream (that is, serializes it). |
1475 |
|
* |
1476 |
+ |
* @param s the stream |
1477 |
+ |
* @throws java.io.IOException if an I/O error occurs |
1478 |
|
* @serialData the current run status and the exception thrown |
1479 |
|
* during execution, or {@code null} if none |
1480 |
|
*/ |
1486 |
|
|
1487 |
|
/** |
1488 |
|
* Reconstitutes this task from a stream (that is, deserializes it). |
1489 |
+ |
* @param s the stream |
1490 |
+ |
* @throws ClassNotFoundException if the class of a serialized object |
1491 |
+ |
* could not be found |
1492 |
+ |
* @throws java.io.IOException if an I/O error occurs |
1493 |
|
*/ |
1494 |
|
private void readObject(java.io.ObjectInputStream s) |
1495 |
|
throws java.io.IOException, ClassNotFoundException { |