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.25 by jsr166, Mon Nov 26 05:55:05 2012 UTC vs.
Revision 1.28 by jsr166, Sat Dec 15 21:26:06 2012 UTC

# Line 83 | Line 83 | package jsr166y;
83   * subdivided) to each element of an array or collection; especially
84   * when the operation takes a significantly different amount of time
85   * to complete for some elements than others, either because of
86 < * intrinsic variation (for example IO) or auxiliary effects such as
86 > * intrinsic variation (for example I/O) or auxiliary effects such as
87   * garbage collection.  Because CountedCompleters provide their own
88   * continuations, other threads need not block waiting to perform
89   * them.
# 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 223 | Line 224 | package jsr166y;
224   *   public static <E> E search(E[] array) {
225   *       return new Searcher<E>(null, array, new AtomicReference<E>(), 0, array.length).invoke();
226   *   }
227 < *}}</pre>
227 > * }}</pre>
228   *
229   * In this example, as well as others in which tasks have no other
230   * effects except to compareAndSet a common result, the trailing

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines