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, wait
getPolicyException
public 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)
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 long getRequestTimeout()
RequestRetryPolicy
getRequestTimeout
in interface RequestRetryPolicy
public long getDelay()
RequestRetryPolicy
getDelay
in interface RequestRetryPolicy
public long getOperationTimeout()
public <R> CompletableFuture<R> wrapOperation(Supplier<CompletableFuture<R>> operation, Executor executor)
RequestRetryPolicy
CompletableFuture
.
wrapOperation
in interface RequestRetryPolicy
R
- 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.