T - exception checking callback function typepublic static final class TarantoolRequestRetryPolicies.InfiniteRetryPolicy<T extends Predicate<Throwable>> extends Object implements RequestRetryPolicy
true.DEFAULT_DELAY, DEFAULT_REQUEST_TIMEOUT| Constructor and Description |
|---|
InfiniteRetryPolicy(long requestTimeout,
long operationTimeout,
long delay,
T exceptionCheck)
Basic constructor
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
canRetryRequest(Throwable throwable)
A callback called when the request ends with an exception.
|
long |
getDelay()
Delay that is used to wait before start attempt again.
|
long |
getOperationTimeout() |
long |
getRequestTimeout()
Get timeout value for one retry attempt.
|
<R> CompletableFuture<R> |
wrapOperation(Supplier<CompletableFuture<R>> operation,
Executor executor)
Wrap a generic operation taking an arbitrary number of arguments and returning a
CompletableFuture. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetPolicyExceptionpublic InfiniteRetryPolicy(long requestTimeout,
long operationTimeout,
long delay,
T exceptionCheck)
requestTimeout - timeout for one retry attempt, in millisecondsoperationTimeout - timeout for the whole operation, in millisecondsdelay - delay between attempts, in millisecondsexceptionCheck - predicate checking whether the given exception may be retriedpublic 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 long getRequestTimeout()
RequestRetryPolicygetRequestTimeout in interface RequestRetryPolicypublic long getDelay()
RequestRetryPolicygetDelay in interface RequestRetryPolicypublic long getOperationTimeout()
public <R> CompletableFuture<R> wrapOperation(Supplier<CompletableFuture<R>> operation, Executor executor)
RequestRetryPolicyCompletableFuture.
wrapOperation in interface RequestRetryPolicyR - operation result typeoperation - supplier for the operation to perform. Must return a new operation instanceexecutor - executor in which the retry callbacks will be scheduledCompletableFuture with the same type as the operation result typeCopyright © 2025 Picodata. All rights reserved.