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 and returns true if a retry has been scheduled for else returns returns false and completes
the execution and associated
CompletableFuture. |
boolean |
retryFor(Object result)
Records an execution and returns true if a retry has been scheduled for the
result, else returns false and
marks the execution and associated CompletableFuture as complete. |
boolean |
retryFor(Object result,
Throwable failure)
Records an execution and returns true if a retry has been scheduled for the
result or failure, else
returns false and marks the execution and associated CompletableFuture as complete. |
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, getElapsedTime, getLastFailure, getLastResult, getLastResult, getStartTimepublic 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()
CompletableFuture.IllegalStateException - if a retry method has already been called or the execution is already completepublic boolean retryFor(Object result)
result, else returns false and
marks the execution and associated CompletableFuture as complete.IllegalStateException - if a retry method has already been called or the execution is already completepublic boolean retryFor(Object result, Throwable failure)
result or failure, else
returns false and marks the execution and associated CompletableFuture as complete.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 © 2019. All rights reserved.