Package io.tarantool.driver.api.retry
Class TarantoolRequestRetryPolicies.AttemptsBoundRetryPolicyFactory<T extends Predicate<Throwable>>
- java.lang.Object
-
- io.tarantool.driver.api.retry.TarantoolRequestRetryPolicies.AttemptsBoundRetryPolicyFactory<T>
-
- Type Parameters:
T
- exception checking predicate type
- All Implemented Interfaces:
RequestRetryPolicyFactory
- Enclosing class:
- TarantoolRequestRetryPolicies
public static final class TarantoolRequestRetryPolicies.AttemptsBoundRetryPolicyFactory<T extends Predicate<Throwable>> extends Object implements RequestRetryPolicyFactory
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TarantoolRequestRetryPolicies.AttemptsBoundRetryPolicyFactory.Builder<T extends Predicate<Throwable>>
-
Constructor Summary
Constructors Constructor Description AttemptsBoundRetryPolicyFactory(int numberOfAttempts, long requestTimeout, long delay, T exceptionCheck)
Basic constructor with timeout and delay
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T extends Predicate<Throwable>>
TarantoolRequestRetryPolicies.AttemptsBoundRetryPolicyFactory.Builder<T>builder(int attempts, T exceptionCheck)
Create a builder for this factoryRequestRetryPolicy
create()
Instantiate a new request retry policy instance.long
getDelay()
Getter for delayT
getExceptionCheck()
Getter for exception handlerint
getNumberOfAttempts()
Getter for number of attemptslong
getRequestTimeout()
Getter for request timeout
-
-
-
Constructor Detail
-
AttemptsBoundRetryPolicyFactory
public AttemptsBoundRetryPolicyFactory(int numberOfAttempts, long requestTimeout, long delay, T exceptionCheck)
Basic constructor with timeout and delay- Parameters:
numberOfAttempts
- maximum number of retry attemptsrequestTimeout
- timeout for one retry attempt, in millisecondsdelay
- delay between retry attempts, in millisecondsexceptionCheck
- predicate checking whether the given exception may be retried
-
-
Method Detail
-
builder
public static <T extends Predicate<Throwable>> TarantoolRequestRetryPolicies.AttemptsBoundRetryPolicyFactory.Builder<T> builder(int attempts, T exceptionCheck)
Create a builder for this factory- Type Parameters:
T
- exception checking predicate type- Parameters:
attempts
- maximum number of attemptsexceptionCheck
- function checking whether the given exception may be retried- Returns:
- new builder instance
-
create
public RequestRetryPolicy create()
Description copied from interface:RequestRetryPolicyFactory
Instantiate a new request retry policy instance. The policy may be either stateful or stateless, so depending on that the policy may be either instantiated as a singleton or once per request.- Specified by:
create
in interfaceRequestRetryPolicyFactory
- Returns:
- new policy instance
-
getNumberOfAttempts
public int getNumberOfAttempts()
Getter for number of attempts- Returns:
- number of attempts
-
getExceptionCheck
public T getExceptionCheck()
Getter for exception handler- Returns:
- exception handler
-
getDelay
public long getDelay()
Getter for delay- Returns:
- delay in milliseconds
-
getRequestTimeout
public long getRequestTimeout()
Getter for request timeout- Returns:
- request timeout in milliseconds
-
-