Class RetryStrategy
java.lang.Object
migratedb.v1.core.internal.strategy.RetryStrategy
A class that retries a Callable a given number of times until success is obtained.
-
Constructor Summary
ConstructorsConstructorDescriptionRetryStrategy(int numberOfRetries) A class that retries a Callable a given number of times until success is obtained. -
Method Summary
Modifier and TypeMethodDescriptionvoiddoWithRetries(SqlCallable<Boolean> callable, String interruptionMessage, String retriesExceededMessage) Keep retrying a Callable with a potentially varying wait on each iteration, until one of the following happens: - the callable returnstrue; - an InterruptedException happens - the number of retries is exceeded.
-
Constructor Details
-
RetryStrategy
public RetryStrategy(int numberOfRetries) A class that retries a Callable a given number of times until success is obtained.
-
-
Method Details
-
doWithRetries
public void doWithRetries(SqlCallable<Boolean> callable, String interruptionMessage, String retriesExceededMessage) throws SQLException Keep retrying a Callable with a potentially varying wait on each iteration, until one of the following happens: - the callable returnstrue; - an InterruptedException happens - the number of retries is exceeded.- Parameters:
callable- The callable to retryinterruptionMessage- The message to relay if interruption happensretriesExceededMessage- The message to relay if the number of retries is exceeded- Throws:
SQLException
-