public class Invocation extends InvocationStats
RetryPolicy.| Constructor and Description |
|---|
Invocation(RetryPolicy retryPolicy)
Creates a new Invocation 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 invocation. |
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 invocation. |
boolean |
canRetryOn(Throwable failure)
Returns true if a retry can be performed for the
failure, else returns false and completes the invocation. |
void |
complete()
Completes the invocation.
|
boolean |
complete(Object result)
Attempts to complete the invocation with the
result. |
<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 invocation is complete.
|
boolean |
recordFailure(Throwable failure)
Records a failed invocation attempt and returns true if a retry can be performed for the
failure, else
returns false and completes the invocation. |
getAttemptCount, getElapsedMillis, getElapsedNanos, getStartMillis, getStartNanospublic Invocation(RetryPolicy retryPolicy)
retryPolicy.NullPointerException - if retryPolicy is nullpublic boolean canRetryFor(Object result)
result, else returns false and completes the invocation.IllegalStateException - if the invocation is already completepublic boolean canRetryFor(Object result, Throwable failure)
result or failure, else returns false and
completes the invocation.IllegalStateException - if the invocation is already completepublic boolean canRetryOn(Throwable failure)
failure, else returns false and completes the invocation.NullPointerException - if failure is nullIllegalStateException - if the invocation is already completepublic void complete()
IllegalStateException - if the invocation is already completepublic boolean complete(Object result)
result. Returns true on success, else false if completion
failed and should be retried.IllegalStateException - if the invocation is already completepublic <T extends Throwable> T getLastFailure()
recordFailure(Throwable)public <T> T getLastResult()
complete(),
complete(Object)public long getWaitMillis()
public long getWaitNanos()
public boolean isComplete()
complete(),
complete(Object),
recordFailure(Throwable)public boolean recordFailure(Throwable failure)
failure, else
returns false and completes the invocation.
Alias of canRetryOn(Throwable)
IllegalStateException - if the invocation is already completeCopyright © 2016. All Rights Reserved.