R - result typepublic class Execution<R> extends AbstractExecution<R>
RetryPolicy.| Constructor and Description |
|---|
Execution(Policy<R>... policies)
Creates a new
Execution that will use the policies to handle failures. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canRetryFor(R result)
Records an execution and returns true if a retry can be performed for the
result, else returns false and
marks the execution as complete. |
boolean |
canRetryFor(R result,
Throwable failure)
Records an execution and returns true if a retry can be performed for the
result or failure, else
returns false and marks the execution as complete. |
boolean |
canRetryOn(Throwable failure)
Records an execution and returns true if a retry can be performed for the
failure, else returns false and
marks the execution as complete. |
void |
complete()
Records and completes the execution successfully.
|
boolean |
complete(R result)
Records and attempts to complete the execution with the
result. |
boolean |
recordFailure(Throwable failure)
Records a failed execution and returns true if a retry can be performed for the
failure, else returns false
and completes the execution. |
getWaitTime, isCompletecopy, getAttemptCount, getElapsedAttemptTime, getElapsedTime, getExecutionCount, getLastFailure, getLastResult, getLastResult, getStartTime, isCancelled, isFirstAttempt, isRetry, toString@SafeVarargs public Execution(Policy<R>... policies)
Execution that will use the policies to handle failures. Policies are applied in
reverse order, with the last policy being applied first.NullPointerException - if policies is nullIllegalArgumentException - if policies is emptypublic boolean canRetryFor(R result)
result, else returns false and
marks the execution as complete.IllegalStateException - if the execution is already completepublic boolean canRetryFor(R result, Throwable failure)
result or failure, else
returns false and marks the execution as complete.IllegalStateException - if the execution is already completepublic boolean canRetryOn(Throwable failure)
failure, else returns false and
marks the execution as complete.NullPointerException - if failure is nullIllegalStateException - if the execution is already completepublic void complete()
IllegalStateException - if the execution is already completepublic boolean complete(R result)
result. Returns true on success, else false if
completion failed and execution should be retried.IllegalStateException - if the execution is already completepublic boolean recordFailure(Throwable failure)
failure, else returns false
and completes the execution.
Alias of canRetryOn(Throwable)
NullPointerException - if failure is nullIllegalStateException - if the execution is already completeCopyright © 2021. All rights reserved.