public interface RetryPolicy
This policy can be used it to automatically recover from temporary problems like expired sessions, service unavailable, network issues.
Modifier and Type | Interface and Description |
---|---|
static class |
RetryPolicy.RetryContext
Context about an invocation.
|
static class |
RetryPolicy.RetrySpec
Retry specification.
|
Modifier and Type | Method and Description |
---|---|
RetryPolicy.RetrySpec |
onInvocationError(java.lang.RuntimeException error,
RetryPolicy.RetryContext retryContext,
int invocationAttempt)
An invocation error has occurred.
|
RetryPolicy.RetrySpec onInvocationError(java.lang.RuntimeException error, RetryPolicy.RetryContext retryContext, int invocationAttempt)
The error can be any exception that can be reported by the stub. See
AsyncCallback.onError(RuntimeException)
for details on possible
errors.
The method is expected to return a retry specification. This
specification will be used to retry the invocation. If the method
returns null
or throws a RuntimeException
, there
will be no further attempts and the invocation will fail.
error
- invocation error; must not be nullretryContext
- context about the invocation error; must not be null
invocationAttempt
- number of the invocation attempt; first attempt
is 0, second attempt (after error on retry) is 1, etc.null
means no retry