40 |
|
* <pre> |
41 |
|
* class GraphVisitor extends LinkedAsyncAction { |
42 |
|
* final Node node; |
43 |
< |
* GraphVisitor(GraphVistor parent, Node node) { |
43 |
> |
* GraphVisitor(GraphVisitor parent, Node node) { |
44 |
|
* super(parent); this.node = node; |
45 |
|
* } |
46 |
|
* protected void compute() { |
69 |
|
static final AtomicIntegerFieldUpdater<LinkedAsyncAction> controlStateUpdater = |
70 |
|
AtomicIntegerFieldUpdater.newUpdater(LinkedAsyncAction.class, "controlState"); |
71 |
|
|
72 |
– |
|
72 |
|
/** |
73 |
|
* Parent to notify on completion |
74 |
|
*/ |
156 |
|
* default version of this method does nothing and returns |
157 |
|
* {@code true}. |
158 |
|
* @return true if this task's exception should be propagated to |
159 |
< |
* this task's parent. |
159 |
> |
* this task's parent |
160 |
|
*/ |
161 |
|
protected boolean onException() { |
162 |
|
return true; |
211 |
|
* @param ex the exception to throw when joining this task |
212 |
|
* @throws NullPointerException if ex is null |
213 |
|
* @throws Throwable if any invocation of |
214 |
< |
* {@code onException} does so. |
214 |
> |
* {@code onException} does so |
215 |
|
*/ |
216 |
|
public final void completeExceptionally(Throwable ex) { |
217 |
|
LinkedAsyncAction a = this; |
230 |
|
|
231 |
|
/** |
232 |
|
* Returns this task's parent, or null if none. |
233 |
< |
* @return this task's parent, or null if none. |
233 |
> |
* @return this task's parent, or null if none |
234 |
|
*/ |
235 |
|
public final LinkedAsyncAction getParent() { |
236 |
|
return parent; |
238 |
|
|
239 |
|
/** |
240 |
|
* Returns the number of subtasks that have not yet completed. |
241 |
< |
* @return the number of subtasks that have not yet completed. |
241 |
> |
* @return the number of subtasks that have not yet completed |
242 |
|
*/ |
243 |
|
public final int getPendingSubtaskCount() { |
244 |
|
return getControlState(); |
339 |
|
controlStateUpdater.decrementAndGet(this); |
340 |
|
} |
341 |
|
|
343 |
– |
|
342 |
|
} |