public abstract class IteratingNestedCallback extends IteratingCallback
This specialized callback is used when breaking up an asynchronous task into smaller asynchronous tasks. A typical pattern is that a successful callback is used to schedule the next sub task, but if that task completes quickly and uses the calling thread to callback the success notification, this can result in a growing stack depth.
To avoid this issue, this callback uses an AtomicBoolean to note if the success callback has been called during the processing of a sub task, and if so then the processing iterates rather than recurses.
This callback is passed to the asynchronous handling of each sub task and a
call the IteratingCallback.succeeded() on this call back represents completion of the
subtask. Only once all the subtasks are completed is the
Callback.succeeded() method called on the Callback instance
passed the the IteratingNestedCallback(Callback) constructor.
IteratingCallback.ActionCallback.Completable, Callback.Nested, Callback.NonBlocking| 构造器和说明 |
|---|
IteratingNestedCallback(Callback callback) |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
isNonBlocking() |
protected void |
onCompleteFailure(Throwable x)
Invoked when the overall task has completed with a failure.
|
protected void |
onCompleteSuccess()
Invoked when the overall task has completed successfully.
|
String |
toString() |
close, failed, isClosed, isFailed, isSucceeded, iterate, process, reset, succeededpublic IteratingNestedCallback(Callback callback)
public boolean isNonBlocking()
protected void onCompleteSuccess()
IteratingCallbackprotected void onCompleteFailure(Throwable x)
IteratingCallbackonCompleteFailure 在类中 IteratingCallbackx - the throwable to indicate cause of failureIteratingCallback.onCompleteSuccess()public String toString()
toString 在类中 IteratingCallbackCopyright © 2016. All rights reserved.