public class Execution extends ExecutionContext
RetryPolicy.| Constructor and Description |
|---|
Execution(CircuitBreaker circuitBreaker)
Creates a new Execution for the
circuitBreaker. |
Execution(RetryPolicy retryPolicy)
Creates a new Execution for the
retryPolicy. |
Execution(RetryPolicy retryPolicy,
CircuitBreaker circuitBreaker)
Creates a new Execution for the
retryPolicy and circuitBreaker. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canRetryFor(Object 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(Object 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.
|
boolean |
complete(Object result)
Records and attempts to complete the execution with the
result. |
<T extends Throwable> |
getLastFailure()
Returns the last failure that was recorded.
|
<T> T |
getLastResult()
Returns the last result that was recorded.
|
Duration |
getWaitTime()
Returns the time to wait before the next execution attempt.
|
boolean |
isComplete()
Returns whether the execution is complete.
|
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. |
getElapsedTime, getExecutions, getStartTimepublic Execution(CircuitBreaker circuitBreaker)
circuitBreaker.NullPointerException - if circuitBreaker is nullpublic Execution(RetryPolicy retryPolicy)
retryPolicy.NullPointerException - if retryPolicy is nullpublic Execution(RetryPolicy retryPolicy, CircuitBreaker circuitBreaker)
retryPolicy and circuitBreaker.NullPointerException - if retryPolicy or circuitBreaker are nullpublic boolean canRetryFor(Object result)
result, else returns false and
marks the execution as complete.IllegalStateException - if the execution is already completepublic boolean canRetryFor(Object 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(Object 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 completepublic <T extends Throwable> T getLastFailure()
public <T> T getLastResult()
public Duration getWaitTime()
public boolean isComplete()
Copyright © 2017. All Rights Reserved.