refactoring

pull/2323/head
Nikita Koksharov 5 years ago
parent 094274a465
commit eb962251f4

@ -226,17 +226,11 @@ public class RedisExecutor<V, R> {
}
attempt++;
Timeout timeout;
if (retryInterval > 0 && attempts > 0) {
timeout = connectionManager.newTimeout(this, retryInterval, TimeUnit.MILLISECONDS);
} else {
timeout = MasterSlaveConnectionManager.DUMMY_TIMEOUT;
}
RedisExecutor.this.timeout = timeout;
scheduleRetryTimeout(connectionFuture, attemptPromise);
return;
}
if (writeFuture.isDone() && writeFuture.isSuccess()) {
if (writeFuture.isSuccess()) {
return;
}
}
@ -308,6 +302,10 @@ public class RedisExecutor<V, R> {
timeout.cancel();
scheduleResponseTimeout(attemptPromise, connection);
}
private void scheduleResponseTimeout(RPromise<R> attemptPromise, RedisConnection connection) {
long timeoutTime = responseTimeout;
if (command != null
&& (RedisCommands.BLOCKING_COMMAND_NAMES.contains(command.getName())

@ -666,8 +666,8 @@ public class MasterSlaveConnectionManager implements ConnectionManager {
result.awaitUninterruptibly(timeout, unit);
resolverGroup.close();
timer.stop();
shutdownLatch.close();
timer.stop();
shutdownPromise.trySuccess(null);
shutdownLatch.awaitUninterruptibly();
@ -697,9 +697,12 @@ public class MasterSlaveConnectionManager implements ConnectionManager {
try {
return timer.newTimeout(task, delay, unit);
} catch (IllegalStateException e) {
// timer is shutdown
if (isShuttingDown()) {
return DUMMY_TIMEOUT;
}
throw e;
}
}
@Override

Loading…
Cancel
Save