public class Execution extends ExecutionStats
RetryPolicy.| Constructor and Description |
|---|
Execution(RetryPolicy retryPolicy)
Creates a new Execution for the
retryPolicy. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canRetryFor(Object result)
Returns true if a retry can be performed for the
result, else returns false and completes the execution. |
boolean |
canRetryFor(Object result,
Throwable failure)
Returns true if a retry can be performed for the
result or failure, else returns false and
completes the execution. |
boolean |
canRetryOn(Throwable failure)
Returns true if a retry can be performed for the
failure, else returns false and completes the execution. |
void |
complete()
Completes the execution.
|
boolean |
complete(Object result)
Attempts to complete the execution with the
result. |
boolean |
fail(Throwable failure)
Fails the execution attempt and returns true if a retry can be performed for the
failure, else returns
false and completes the execution. |
<T extends Throwable> |
getLastFailure()
Returns the last failure that was recorded.
|
<T> T |
getLastResult()
Returns the last result that was recorded.
|
long |
getWaitMillis()
Returns the wait time in milliseconds.
|
long |
getWaitNanos()
Returns the wait time in nanoseconds.
|
boolean |
isComplete()
Returns whether the execution is complete.
|
getElapsedMillis, getElapsedNanos, getExecutions, getStartMillis, getStartNanospublic Execution(RetryPolicy retryPolicy)
retryPolicy.NullPointerException - if retryPolicy is nullpublic boolean canRetryFor(Object result)
result, else returns false and completes the execution.IllegalStateException - if the execution is already completepublic boolean canRetryFor(Object result, Throwable failure)
result or failure, else returns false and
completes the execution.IllegalStateException - if the execution is already completepublic boolean canRetryOn(Throwable failure)
failure, else returns false and completes the execution.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 should be retried.IllegalStateException - if the execution is already completepublic <T extends Throwable> T getLastFailure()
fail(Throwable)public <T> T getLastResult()
complete(),
complete(Object)public long getWaitMillis()
public long getWaitNanos()
public boolean isComplete()
complete(),
complete(Object),
fail(Throwable)public boolean fail(Throwable failure)
failure, else returns
false and completes the execution.
Alias of canRetryOn(Throwable)
IllegalStateException - if the execution is already completeCopyright © 2016. All Rights Reserved.