command future cancel state checking fixed

pull/297/head
Nikita 9 years ago
parent 8c59eca279
commit b030d88101

@ -16,7 +16,6 @@
package org.redisson; package org.redisson;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Queue; import java.util.Queue;
@ -224,7 +223,12 @@ public class CommandBatchExecutorService extends CommandExecutorService {
connectionManager.getShutdownLatch().release(); connectionManager.getShutdownLatch().release();
} }
if (attemptPromise.isDone() || mainPromise.isCancelled()) { if (attemptPromise.isDone()) {
return;
}
if (mainPromise.isCancelled()) {
attemptPromise.cancel(false);
return; return;
} }

@ -440,7 +440,12 @@ public class CommandExecutorService implements CommandExecutor {
connectionManager.getShutdownLatch().release(); connectionManager.getShutdownLatch().release();
} }
if (attemptPromise.isDone() || mainPromise.isCancelled()) { if (attemptPromise.isDone()) {
return;
}
if (mainPromise.isCancelled()) {
attemptPromise.cancel(false);
return; return;
} }
@ -457,7 +462,7 @@ public class CommandExecutorService implements CommandExecutor {
} }
}; };
ex.set(new RedisTimeoutException("Command execution timeout for command: " + command + " with params " + Arrays.toString(params))); ex.set(new RedisTimeoutException("Command execution timeout for command: " + command + " with params " + Arrays.toString(params) + " attempt " + attempt));
final Timeout timeout = connectionManager.newTimeout(retryTimerTask, connectionManager.getConfig().getTimeout(), TimeUnit.MILLISECONDS); final Timeout timeout = connectionManager.newTimeout(retryTimerTask, connectionManager.getConfig().getTimeout(), TimeUnit.MILLISECONDS);
connectionFuture.addListener(new FutureListener<RedisConnection>() { connectionFuture.addListener(new FutureListener<RedisConnection>() {

Loading…
Cancel
Save