R
- result typepublic interface Execution<R> extends ExecutionContext<R>
policies
. Execution
results must be explicitly recorded via one of the record
methods.Modifier and Type | Method and Description |
---|---|
void |
complete()
Records and completes the execution successfully.
|
Duration |
getDelay()
Returns the time to delay before the next execution attempt.
|
boolean |
isComplete()
Returns whether the execution is complete or if it can be retried.
|
static <R> Execution<R> |
of(Policy<R> outerPolicy,
Policy<R>... policies)
Creates a new
Execution that will use the outerPolicy and innerPolicies to handle
failures. |
void |
record(R result,
Throwable exception)
Records an execution
result or exception which triggers failure handling, if needed, by the
configured policies. |
void |
recordException(Throwable exception)
Records an
exception which triggers failure handling, if needed, by the configured policies. |
void |
recordResult(R result)
Records an execution
result which triggers failure handling, if needed, by the configured policies. |
getAttemptCount, getElapsedAttemptTime, getElapsedTime, getExecutionCount, getLastException, getLastResult, getLastResult, getStartTime, isCancelled, isFirstAttempt, isRetry, onCancel
@SafeVarargs static <R> Execution<R> of(Policy<R> outerPolicy, Policy<R>... policies)
Execution
that will use the outerPolicy
and innerPolicies
to handle
failures. Policies are applied in reverse order, with the last policy being applied first.NullPointerException
- if outerPolicy
is nullvoid complete()
IllegalStateException
- if the execution is already completeboolean isComplete()
Duration getDelay()
0
if an execution has not yet
occurred.void record(R result, Throwable exception)
result
or exception
which triggers failure handling, if needed, by the
configured policies. If policy handling is not possible or completed, the execution is completed.IllegalStateException
- if the execution is already completevoid recordResult(R result)
result
which triggers failure handling, if needed, by the configured policies. If
policy handling is not possible or completed, the execution is completed.IllegalStateException
- if the execution is already completevoid recordException(Throwable exception)
exception
which triggers failure handling, if needed, by the configured policies. If policy
handling is not possible or completed, the execution is completed.IllegalStateException
- if the execution is already completeCopyright © 2022. All rights reserved.