Class RetryStrategy
- java.lang.Object
-
- migratedb.v1.core.internal.strategy.RetryStrategy
-
public class RetryStrategy extends Object
A class that retries a Callable a given number of times until success is obtained.
-
-
Constructor Summary
Constructors Constructor Description RetryStrategy(int numberOfRetries)A class that retries a Callable a given number of times until success is obtained.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddoWithRetries(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.
-
-
-
Method Detail
-
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
-
-