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

    Modifier and Type
    Method
    Description
    void
    doWithRetries(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 returns true; - an InterruptedException happens - the number of retries is exceeded.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 returns true; - an InterruptedException happens - the number of retries is exceeded.
      Parameters:
      callable - The callable to retry
      interruptionMessage - The message to relay if interruption happens
      retriesExceededMessage - The message to relay if the number of retries is exceeded
      Throws:
      SQLException