ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/jsr166y/forkjoin/LinkedAsyncAction.java
(Generate patch)

Comparing jsr166/src/jsr166y/forkjoin/LinkedAsyncAction.java (file contents):
Revision 1.5 by dl, Mon Jul 7 16:53:19 2008 UTC vs.
Revision 1.6 by jsr166, Fri Jul 25 18:28:59 2008 UTC

# Line 42 | Line 42 | import java.util.concurrent.atomic.*;
42   * this, you would create a GraphVisitor for the root node with null
43   * parent, and <tt>invoke</tt> in a ForkJoinPool. Upon return, all
44   * reachable nodes will have been visited.
45 < *
45 > *
46   * <pre>
47   * class GraphVisitor extends LinkedAsyncAction {
48   *    final Node node;
# Line 93 | Line 93 | public abstract class LinkedAsyncAction
93       */
94      protected LinkedAsyncAction(LinkedAsyncAction parent) {
95          this.parent = parent;
96 <        if (parent != null)
96 >        if (parent != null)
97              pendingCountUpdater.incrementAndGet(parent);
98      }
99  
# Line 109 | Line 109 | public abstract class LinkedAsyncAction
109       */
110      protected LinkedAsyncAction(LinkedAsyncAction parent, boolean register) {
111          this.parent = parent;
112 <        if (parent != null && register)
112 >        if (parent != null && register)
113              pendingCountUpdater.incrementAndGet(parent);
114      }
115  
# Line 127 | Line 127 | public abstract class LinkedAsyncAction
127       * to complete before it completes
128       * @param pending the pending join count
129       */
130 <    protected LinkedAsyncAction(LinkedAsyncAction parent,
130 >    protected LinkedAsyncAction(LinkedAsyncAction parent,
131                            boolean register,
132                            int pending) {
133          this.parent = parent;
134          pendingCount = pending;
135 <        if (parent != null && register)
135 >        if (parent != null && register)
136              pendingCountUpdater.incrementAndGet(parent);
137      }
138  
# Line 187 | Line 187 | public abstract class LinkedAsyncAction
187       * exception is encountered in any <tt>onCompletion</tt>
188       * invocation, that task and its ancestors
189       * <tt>finishExceptionally</tt>.
190 <     *
190 >     *
191       * @param result must be <tt>null</tt>.
192       */
193      public final void finish(Void result) {
# Line 200 | Line 200 | public abstract class LinkedAsyncAction
200                  } catch (Throwable rex) {
201                      a.finishExceptionally(rex);
202                      return;
203 <                }
203 >                }
204                  a.setDone();
205                  a = a.parent;
206              }
# Line 244 | Line 244 | public abstract class LinkedAsyncAction
244       * Returns this task's parent, or null if none.
245       * @return this task's parent, or null if none.
246       */
247 <    public final LinkedAsyncAction getParent() {
248 <        return parent;
247 >    public final LinkedAsyncAction getParent() {
248 >        return parent;
249      }
250  
251      /**
252       * Returns the number of subtasks that have not yet completed.
253       * @return the number of subtasks that have not yet completed.
254       */
255 <    public final int getPendingSubtaskCount() {
256 <        return pendingCount;
255 >    public final int getPendingSubtaskCount() {
256 >        return pendingCount;
257      }
258  
259      /**
260       * Always returns null.
261       * @return null
262       */
263 <    public final Void rawResult() {
264 <        return null;
263 >    public final Void rawResult() {
264 >        return null;
265      }
266  
267      /**
# Line 295 | Line 295 | public abstract class LinkedAsyncAction
295          if (pendingCount != 0)
296              pendingCount = 0;
297          this.parent = parent;
298 <        if (parent != null && register)
298 >        if (parent != null && register)
299              pendingCountUpdater.incrementAndGet(parent);
300      }
301  
# Line 307 | Line 307 | public abstract class LinkedAsyncAction
307       * to complete before it completes
308       * @param pending the pending join count
309       */
310 <    public void reinitialize(LinkedAsyncAction parent,
310 >    public void reinitialize(LinkedAsyncAction parent,
311                               boolean register,
312                               int pending) {
313          super.reinitialize();
314          pendingCount = pending;
315          this.parent = parent;
316 <        if (parent != null && register)
316 >        if (parent != null && register)
317              pendingCountUpdater.incrementAndGet(parent);
318      }
319  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines