Stop HashedWheelTimer after exception in constructor

pull/435/head
Dmitry Bobrov 9 years ago
parent 53884ef0aa
commit d9c97a881e

@ -96,11 +96,7 @@ public class ClusterConnectionManager extends MasterSlaveConnectionManager {
}
if (lastPartitions.isEmpty()) {
try {
group.shutdownGracefully().await();
} catch (Exception e) {
// skip it
}
stopThreads();
throw new RedisConnectionException("Can't connect to servers!", lastException);
}

@ -202,11 +202,7 @@ public class MasterSlaveConnectionManager implements ConnectionManager {
try {
initEntry(config);
} catch (RuntimeException e) {
try {
group.shutdownGracefully().await();
} catch (Exception e1) {
// skip
}
stopThreads();
throw e;
}
}
@ -741,4 +737,12 @@ public class MasterSlaveConnectionManager implements ConnectionManager {
return connectionEventsHub;
}
protected void stopThreads() {
timer.stop();
try {
group.shutdownGracefully().await();
} catch (InterruptedException ignored) {
Thread.currentThread().interrupt();
}
}
}

Loading…
Cancel
Save