Fixed - Exceptions during shutdown. #723

pull/727/head
Nikita 8 years ago
parent f0f910b63c
commit 05cf35ce97

@ -345,6 +345,9 @@ public class ClusterConnectionManager extends MasterSlaveConnectionManager {
scheduleClusterChangeCheck(cfg, null);
return;
}
if (!getShutdownLatch().acquire()) {
return;
}
final URI uri = iterator.next();
RFuture<RedisConnection> connectionFuture = connect(cfg, uri);
connectionFuture.addListener(new FutureListener<RedisConnection>() {
@ -352,6 +355,7 @@ public class ClusterConnectionManager extends MasterSlaveConnectionManager {
public void operationComplete(Future<RedisConnection> future) throws Exception {
if (!future.isSuccess()) {
lastException.set(future.cause());
getShutdownLatch().release();
checkClusterState(cfg, iterator, lastException);
return;
}
@ -370,6 +374,7 @@ public class ClusterConnectionManager extends MasterSlaveConnectionManager {
if (!future.isSuccess()) {
log.error("Can't execute CLUSTER_NODES with " + connection.getRedisClient().getAddr(), future.cause());
close(connection);
getShutdownLatch().release();
scheduleClusterChangeCheck(cfg, iterator);
return;
}
@ -393,6 +398,7 @@ public class ClusterConnectionManager extends MasterSlaveConnectionManager {
public void operationComplete(Future<Void> future) throws Exception {
checkSlotsMigration(newPartitions, nodesValue.toString());
checkSlotsChange(cfg, newPartitions, nodesValue.toString());
getShutdownLatch().release();
scheduleClusterChangeCheck(cfg, null);
}
});

@ -744,7 +744,6 @@ public class MasterSlaveConnectionManager implements ConnectionManager {
for (MasterSlaveEntry entry : entries.values()) {
entry.shutdown();
}
timer.stop();
if (!sharedExecutor) {
executor.shutdown();
@ -758,6 +757,7 @@ public class MasterSlaveConnectionManager implements ConnectionManager {
if (!sharedEventLoopGroup) {
group.shutdownGracefully(quietPeriod, timeout, unit).syncUninterruptibly();
}
timer.stop();
}
@Override

Loading…
Cancel
Save