Package io.tarantool.driver.api.retry
Class TarantoolRequestRetryPolicies
- java.lang.Object
-
- io.tarantool.driver.api.retry.TarantoolRequestRetryPolicies
-
public final class TarantoolRequestRetryPolicies extends Object
Class-container for built-in request retry policies
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TarantoolRequestRetryPolicies.AttemptsBoundRetryPolicy<T extends Predicate<Throwable>>
Retry policy that accepts a maximum number of attempts and an exception checking predicate.static class
TarantoolRequestRetryPolicies.AttemptsBoundRetryPolicyFactory<T extends Predicate<Throwable>>
static class
TarantoolRequestRetryPolicies.InfiniteRetryPolicy<T extends Predicate<Throwable>>
Retry policy that performs unbounded number of attempts.static class
TarantoolRequestRetryPolicies.InfiniteRetryPolicyFactory<T extends Predicate<Throwable>>
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static TarantoolRequestRetryPolicies.AttemptsBoundRetryPolicyFactory.Builder<Predicate<Throwable>>
byNumberOfAttempts(int numberOfAttempts)
Create a factory for retry policy bound by retry attempts.static <T extends Predicate<Throwable>>
TarantoolRequestRetryPolicies.AttemptsBoundRetryPolicyFactory.Builder<T>byNumberOfAttempts(int numberOfAttempts, T exceptionCheck)
Create a factory for retry policy bound by retry attemptsstatic Predicate<Throwable>
retryNetworkErrors()
Check all known network exceptionsstatic Predicate<Throwable>
retryTarantoolNoSuchProcedureErrors()
static <T extends Predicate<Throwable>>
TarantoolRequestRetryPolicies.InfiniteRetryPolicyFactory.Builder<T>unbound()
Create a factory for retry policy with unbounded number of attempts.static <T extends Predicate<Throwable>>
TarantoolRequestRetryPolicies.InfiniteRetryPolicyFactory.Builder<T>unbound(T exceptionCheck)
Create a factory for retry policy with unbounded number of attempts
-
-
-
Method Detail
-
retryNetworkErrors
public static Predicate<Throwable> retryNetworkErrors()
Check all known network exceptions- Returns:
- predicate for checking all network exceptions
-
retryTarantoolNoSuchProcedureErrors
public static Predicate<Throwable> retryTarantoolNoSuchProcedureErrors()
- Returns:
- predicate for checking
TarantoolNoSuchProcedureException
-
byNumberOfAttempts
public static TarantoolRequestRetryPolicies.AttemptsBoundRetryPolicyFactory.Builder<Predicate<Throwable>> byNumberOfAttempts(int numberOfAttempts)
Create a factory for retry policy bound by retry attempts. The retry will be performed on any known network exceptions.- Parameters:
numberOfAttempts
- maximum number of retries, zero value means no retries- Returns:
- new factory instance
-
byNumberOfAttempts
public static <T extends Predicate<Throwable>> TarantoolRequestRetryPolicies.AttemptsBoundRetryPolicyFactory.Builder<T> byNumberOfAttempts(int numberOfAttempts, T exceptionCheck)
Create a factory for retry policy bound by retry attempts- Type Parameters:
T
- exception checking predicate type- Parameters:
numberOfAttempts
- maximum number of retries, zero value means no retriesexceptionCheck
- predicate, checking the given exception whether the request may be retried- Returns:
- new factory instance
-
unbound
public static <T extends Predicate<Throwable>> TarantoolRequestRetryPolicies.InfiniteRetryPolicyFactory.Builder<T> unbound()
Create a factory for retry policy with unbounded number of attempts.retryNetworkErrors()
is used for checking exceptions by default.- Type Parameters:
T
- exception checking predicate type- Returns:
- new factory instance
-
unbound
public static <T extends Predicate<Throwable>> TarantoolRequestRetryPolicies.InfiniteRetryPolicyFactory.Builder<T> unbound(T exceptionCheck)
Create a factory for retry policy with unbounded number of attempts- Type Parameters:
T
- exception checking predicate type- Parameters:
exceptionCheck
- predicate, checking the given exception whether the request may be retried- Returns:
- new factory instance
-
-