Class IteratingNestedCallback
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 subtask, but if that task completes quickly and uses the calling thread to call back 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 subtask, and if so then the processing iterates rather than recurses.
This callback is passed to the asynchronous handling of each subtask
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 IteratingNestedCallback(Callback) constructor.
-
Nested Class Summary
Nested classes/interfaces inherited from class IteratingCallback
IteratingCallback.ActionNested classes/interfaces inherited from interface Callback
Callback.Completable, Callback.Completing, Callback.NestedNested classes/interfaces inherited from interface Invocable
Invocable.Callable, Invocable.InvocationType, Invocable.ReadyTask, Invocable.Task -
Field Summary
Fields inherited from interface Invocable
__nonBlocking -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidInvoked when the overall task has completed with a failure.protected voidInvoked when the overall task has completed successfully.toString()Methods inherited from class IteratingCallback
abort, close, failed, isAborted, isClosed, isFailed, isSucceeded, iterate, onSuccess, process, reset, succeededMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Callback
completeWith
-
Constructor Details
-
IteratingNestedCallback
-
-
Method Details
-
getInvocationType
- Returns:
- The InvocationType of this object
-
onCompleteSuccess
protected void onCompleteSuccess()Description copied from class:IteratingCallbackInvoked when the overall task has completed successfully.- Overrides:
onCompleteSuccessin classIteratingCallback- See Also:
-
onCompleteFailure
Description copied from class:IteratingCallbackInvoked when the overall task has completed with a failure.- Overrides:
onCompleteFailurein classIteratingCallback- Parameters:
x- the throwable to indicate cause of failure- See Also:
-
toString
- Overrides:
toStringin classIteratingCallback
-