Package redis.clients.jedis.executors
Class RetryableCommandExecutor
java.lang.Object
redis.clients.jedis.executors.RetryableCommandExecutor
- All Implemented Interfaces:
AutoCloseable,CommandExecutor
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final org.slf4j.Loggerprotected final intprotected final Durationprotected final ConnectionProvider -
Constructor Summary
ConstructorsConstructorDescriptionRetryableCommandExecutor(ConnectionProvider provider, int maxAttempts, Duration maxTotalRetriesDuration) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()protected <T> Texecute(Connection connection, CommandObject<T> commandObject) WARNING: This method is accessible for the purpose of testing.final <T> TexecuteCommand(CommandObject<T> commandObject) private static longgetBackoffSleepMillis(int attemptsLeft, Instant deadline) private booleanhandleConnectionProblem(int attemptsLeft, int consecutiveConnectionFailures, Instant doneDeadline) Related values should be reset ifTRUEis returned.protected voidsleep(long sleepMillis) WARNING: This method is accessible for the purpose of testing.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface redis.clients.jedis.executors.CommandExecutor
broadcastCommand
-
Field Details
-
log
private final org.slf4j.Logger log -
provider
-
maxAttempts
protected final int maxAttempts -
maxTotalRetriesDuration
-
-
Constructor Details
-
RetryableCommandExecutor
public RetryableCommandExecutor(ConnectionProvider provider, int maxAttempts, Duration maxTotalRetriesDuration)
-
-
Method Details
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
executeCommand
- Specified by:
executeCommandin interfaceCommandExecutor
-
execute
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 ifTRUEis returned.- Parameters:
attemptsLeft-consecutiveConnectionFailures-doneDeadline-- Returns:
- true - if some actions are taken
false - if no actions are taken
-
getBackoffSleepMillis
-
sleep
protected void sleep(long sleepMillis) WARNING: This method is accessible for the purpose of testing. This should not be used or overriden.
-