Class RetryableCommandExecutor

java.lang.Object
redis.clients.jedis.executors.RetryableCommandExecutor
All Implemented Interfaces:
AutoCloseable, CommandExecutor

public class RetryableCommandExecutor extends Object implements CommandExecutor
  • Field Details

    • log

      private final org.slf4j.Logger log
    • provider

      protected final ConnectionProvider provider
    • maxAttempts

      protected final int maxAttempts
    • maxTotalRetriesDuration

      protected final Duration maxTotalRetriesDuration
  • Constructor Details

    • RetryableCommandExecutor

      public RetryableCommandExecutor(ConnectionProvider provider, int maxAttempts, Duration maxTotalRetriesDuration)
  • Method Details

    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • executeCommand

      public final <T> T executeCommand(CommandObject<T> commandObject)
      Specified by:
      executeCommand in interface CommandExecutor
    • execute

      protected <T> T execute(Connection connection, CommandObject<T> commandObject)
      WARNING: This method is accessible for the purpose of testing. This should not be used or overriden.
    • handleConnectionProblem

      private boolean handleConnectionProblem(int attemptsLeft, int consecutiveConnectionFailures, Instant doneDeadline)
      Related values should be reset if TRUE is returned.
      Parameters:
      attemptsLeft -
      consecutiveConnectionFailures -
      doneDeadline -
      Returns:
      true - if some actions are taken
      false - if no actions are taken
    • getBackoffSleepMillis

      private static long getBackoffSleepMillis(int attemptsLeft, Instant deadline)
    • sleep

      protected void sleep(long sleepMillis)
      WARNING: This method is accessible for the purpose of testing. This should not be used or overriden.