ResponseT - attempt response typepublic class BasicResultRetryAlgorithm<ResponseT> extends Object implements ResultRetryAlgorithmWithContext<ResponseT>
ResultRetryAlgorithm. Using this implementation would mean that
all exceptions should be retried, all responses should be accepted (including null) and
no retrying process should ever be canceled.| Constructor and Description |
|---|
BasicResultRetryAlgorithm() |
| Modifier and Type | Method and Description |
|---|---|
TimedAttemptSettings |
createNextAttempt(RetryingContext context,
Throwable previousThrowable,
ResponseT previousResponse,
TimedAttemptSettings previousSettings)
Always returns null, indicating that this algorithm does not provide any specific settings for
the next attempt.
|
TimedAttemptSettings |
createNextAttempt(Throwable previousThrowable,
ResponseT previousResponse,
TimedAttemptSettings previousSettings)
Always returns null, indicating that this algorithm does not provide any specific settings for
the next attempt.
|
boolean |
shouldRetry(RetryingContext context,
Throwable previousThrowable,
ResponseT previousResponse)
Returns
true if an exception was thrown (previousThrowable != null), false otherwise. |
boolean |
shouldRetry(Throwable previousThrowable,
ResponseT previousResponse)
Returns
true if an exception was thrown (previousThrowable != null), false otherwise. |
public TimedAttemptSettings createNextAttempt(Throwable previousThrowable, ResponseT previousResponse, TimedAttemptSettings previousSettings)
createNextAttempt in interface ResultRetryAlgorithm<ResponseT>public TimedAttemptSettings createNextAttempt(RetryingContext context, Throwable previousThrowable, ResponseT previousResponse, TimedAttemptSettings previousSettings)
createNextAttempt in interface ResultRetryAlgorithmWithContext<ResponseT>context - the retrying context of this invocation that can be used to determine the
settings for the next attempt.previousThrowable - exception thrown by the previous attempt (null, if none)previousResponse - response returned by the previous attemptpreviousSettings - previous attempt settingspublic boolean shouldRetry(Throwable previousThrowable, ResponseT previousResponse)
true if an exception was thrown (previousThrowable != null), false otherwise.shouldRetry in interface ResultRetryAlgorithm<ResponseT>public boolean shouldRetry(RetryingContext context, Throwable previousThrowable, ResponseT previousResponse) throws CancellationException
true if an exception was thrown (previousThrowable != null), false otherwise.shouldRetry in interface ResultRetryAlgorithmWithContext<ResponseT>context - the retrying context of this invocation that can be used to determine whether
the call should be retried.previousThrowable - exception thrown by the previous attempt (null, if none)previousResponse - response returned by the previous attempt.CancellationException