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, wait
wrapOperation
public 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()
RequestRetryPolicy
getRequestTimeout
in interface RequestRetryPolicy
public long getDelay()
RequestRetryPolicy
getDelay
in interface RequestRetryPolicy
public int getAttempts()
public int getLimit()
public boolean canRetryRequest(Throwable throwable)
RequestRetryPolicy
true
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 RequestRetryPolicy
throwable
- exception a request failed withpublic Throwable getPolicyException(Throwable ex)
RequestRetryPolicy
getPolicyException
in interface RequestRetryPolicy
ex
- exception that will be wrappedCopyright © 2025 Picodata. All rights reserved.