T - exception checking predicate typepublic static final class TarantoolRequestRetryPolicies.AttemptsBoundRetryPolicy<T extends Predicate<Throwable>> extends Object implements RequestRetryPolicy
true.DEFAULT_DELAY, DEFAULT_REQUEST_TIMEOUT| Constructor and Description |
|---|
AttemptsBoundRetryPolicy(int attempts,
long requestTimeout,
long delay,
T exceptionCheck)
Basic constructor with timeout
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
canRetryRequest(Throwable throwable)
A callback called when the request ends with an exception.
|
int |
getAttempts() |
long |
getDelay()
Delay that is used to wait before start attempt again.
|
int |
getLimit() |
Throwable |
getPolicyException(Throwable ex)
Get an exception stating why the policy cannot repeat the request
|
long |
getRequestTimeout()
Get timeout value for one retry attempt.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitwrapOperationpublic AttemptsBoundRetryPolicy(int attempts,
long requestTimeout,
long delay,
T exceptionCheck)
attempts - maximum number of retry attemptsrequestTimeout - timeout for one retry attempt, in millisecondsdelay - delay between attempts, in millisecondsexceptionCheck - predicate checking whether the given exception may be retriedpublic long getRequestTimeout()
RequestRetryPolicygetRequestTimeout in interface RequestRetryPolicypublic long getDelay()
RequestRetryPolicygetDelay in interface RequestRetryPolicypublic int getAttempts()
public int getLimit()
public boolean canRetryRequest(Throwable throwable)
RequestRetryPolicytrue if and only if the request
may be performed again (e.g. it is a timeout exception and it indicates only that the current server is
overloaded). This may depend not only on the exception type, but also on the other conditions like the allowed
number of retries or the maximum request execution time.
Effective use of the retry policies may be achieved by combining them with multiple server connections and a
ConnectionSelectionStrategy.
canRetryRequest in interface RequestRetryPolicythrowable - exception a request failed withpublic Throwable getPolicyException(Throwable ex)
RequestRetryPolicygetPolicyException in interface RequestRetryPolicyex - exception that will be wrappedCopyright © 2025 Picodata. All rights reserved.