|
|
|
@ -462,18 +462,7 @@ public class CommandAsyncService implements CommandAsyncExecutor {
|
|
|
|
|
int timeoutTime = connectionManager.getConfig().getTimeout();
|
|
|
|
|
if (skipTimeout.contains(details.getCommand().getName())) {
|
|
|
|
|
Integer popTimeout = Integer.valueOf(details.getParams()[details.getParams().length - 1].toString());
|
|
|
|
|
details.getMainPromise().addListener(new FutureListener<R>() {
|
|
|
|
|
@Override
|
|
|
|
|
public void operationComplete(Future<R> future) throws Exception {
|
|
|
|
|
if (!future.isCancelled()) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// cancel handling for commands from skipTimeout collection
|
|
|
|
|
if (details.getAttemptPromise().cancel(true)) {
|
|
|
|
|
connection.forceReconnectAsync();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
handleBlockingOperations(details, connection);
|
|
|
|
|
if (popTimeout == 0) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -494,6 +483,29 @@ public class CommandAsyncService implements CommandAsyncExecutor {
|
|
|
|
|
details.setTimeout(timeout);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private <R, V> void handleBlockingOperations(final AsyncDetails<V, R> details, final RedisConnection connection) {
|
|
|
|
|
final FutureListener<Boolean> listener = new FutureListener<Boolean>() {
|
|
|
|
|
@Override
|
|
|
|
|
public void operationComplete(Future<Boolean> future) throws Exception {
|
|
|
|
|
details.getMainPromise().cancel(true);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
details.getMainPromise().addListener(new FutureListener<R>() {
|
|
|
|
|
@Override
|
|
|
|
|
public void operationComplete(Future<R> future) throws Exception {
|
|
|
|
|
if (!future.isCancelled()) {
|
|
|
|
|
connectionManager.getShutdownPromise().removeListener(listener);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// cancel handling for commands from skipTimeout collection
|
|
|
|
|
if (details.getAttemptPromise().cancel(true)) {
|
|
|
|
|
connection.forceReconnectAsync();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
connectionManager.getShutdownPromise().addListener(listener);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private <R, V> void checkConnectionFuture(final NodeSource source,
|
|
|
|
|
final AsyncDetails<V, R> details) {
|
|
|
|
|
if (details.getAttemptPromise().isDone() || details.getMainPromise().isCancelled() || details.getConnectionFuture().isCancelled()) {
|
|
|
|
|