public final class AsyncExecution extends AbstractExecution
RetryPolicy. May be
explicitly completed or made to retry.| Modifier and Type | Method and Description |
|---|---|
void |
complete()
Completes the execution and the associated
CompletableFuture. |
boolean |
complete(Object result)
Attempts to complete the execution and the associated
CompletableFuture with the result. |
boolean |
complete(Object result,
Throwable failure)
Attempts to complete the execution and the associated
CompletableFuture with the result and failure. |
boolean |
retry()
Records an execution if one has not been recorded yet, attempts to schedule a retry if necessary, and returns
true if a retry has been scheduled else returns false and completes the execution and associated
CompletableFuture. |
boolean |
retryFor(Object result)
Records an execution if one has not been recorded yet for the
result, attempts to schedule a retry if
necessary, and returns true if a retry has been scheduled else returns false and completes the
execution and associated CompletableFuture. |
boolean |
retryFor(Object result,
Throwable failure)
Records an execution if one has not been recorded yet for the
result or failure, attempts to
schedule a retry if necessary, and returns true if a retry has been scheduled else returns false
and completes the execution and associated CompletableFuture. |
boolean |
retryOn(Throwable failure)
Records an execution and returns true if a retry has been scheduled for the
failure, else returns false and
marks the execution and associated CompletableFuture as complete. |
getWaitTime, isCompletecopy, getAttemptCount, getElapsedAttemptTime, getElapsedTime, getLastFailure, getLastResult, getLastResult, getStartTime, isCancelled, isFirstAttempt, isRetry, toStringpublic void complete()
CompletableFuture.IllegalStateException - if the execution is already completepublic boolean complete(Object result)
CompletableFuture with the result. Returns
true on success, else false if completion failed and the execution should be retried via retry().IllegalStateException - if the execution is already completepublic boolean complete(Object result, Throwable failure)
CompletableFuture with the result and failure. Returns true on success, else false if completion failed and the execution should be retried via retry().
Note: the execution may be completed even when the failure is not null, such as when the
RetryPolicy does not allow retries for the failure.
IllegalStateException - if the execution is already completepublic boolean retry()
true if a retry has been scheduled else returns false and completes the execution and associated
CompletableFuture.IllegalStateException - if a retry method has already been called or the execution is already completepublic boolean retryFor(Object result)
result, attempts to schedule a retry if
necessary, and returns true if a retry has been scheduled else returns false and completes the
execution and associated CompletableFuture.IllegalStateException - if a retry method has already been called or the execution is already completepublic boolean retryFor(Object result, Throwable failure)
result or failure, attempts to
schedule a retry if necessary, and returns true if a retry has been scheduled else returns false
and completes the execution and associated CompletableFuture.IllegalStateException - if a retry method has already been called or the execution is already completepublic boolean retryOn(Throwable failure)
failure, else returns false and
marks the execution and associated CompletableFuture as complete.NullPointerException - if failure is nullIllegalStateException - if a retry method has already been called or the execution is already completeCopyright © 2020. All rights reserved.