8 |
|
|
9 |
|
/** |
10 |
|
* Recursive resultless ForkJoinTasks. This class establishes |
11 |
< |
* conventions to parameterize resultless actions as <tt>Void</tt> |
12 |
< |
* ForkJoinTasks. Because <tt>null</tt> is the only valid value of |
13 |
< |
* <tt>Void</tt>, methods such as join always return <tt>null</tt> |
11 |
> |
* conventions to parameterize resultless actions as {@code Void} |
12 |
> |
* ForkJoinTasks. Because {@code null} is the only valid value of |
13 |
> |
* {@code Void}, methods such as join always return {@code null} |
14 |
|
* upon completion. |
15 |
|
* |
16 |
|
* <p><b>Sample Usages.</b> Here is a sketch of a ForkJoin sort that |
17 |
< |
* sorts a given <tt>long[]</tt> array: |
17 |
> |
* sorts a given {@code long[]} array: |
18 |
|
* |
19 |
|
* <pre> |
20 |
|
* class SortTask extends RecursiveAction { |
35 |
|
* } |
36 |
|
* </pre> |
37 |
|
* |
38 |
< |
* You could then sort anArray by creating <tt>new SortTask(anArray, 0, |
39 |
< |
* anArray.length-1) </tt> and invoking it in a ForkJoinPool. |
38 |
> |
* You could then sort anArray by creating {@code new SortTask(anArray, 0, |
39 |
> |
* anArray.length-1) } and invoking it in a ForkJoinPool. |
40 |
|
* As a more concrete simple example, the following task increments |
41 |
|
* each element of an array: |
42 |
|
* <pre> |
66 |
|
* divide-and-conquer approach. Here is a class that sums the squares |
67 |
|
* of each element of a double array, by subdividing out only the |
68 |
|
* right-hand-sides of repeated divisions by two, and keeping track of |
69 |
< |
* them with a chain of <tt>next</tt> references. It uses a dynamic |
70 |
< |
* threshold based on method <tt>surplus</tt>, but counterbalances |
69 |
> |
* them with a chain of {@code next} references. It uses a dynamic |
70 |
> |
* threshold based on method {@code surplus}, but counterbalances |
71 |
|
* potential excess partitioning by directly performing leaf actions |
72 |
|
* on unstolen tasks rather than further subdividing. |
73 |
|
* |