ConnectionWatchdog should handle timer's IllegalStateException properly

pull/1025/head
Nikita 8 years ago
parent 90f1d528ca
commit 42d6df5752

@ -82,12 +82,16 @@ public class ConnectionWatchdog extends ChannelInboundHandlerAdapter {
return;
}
timer.newTimeout(new TimerTask() {
@Override
public void run(Timeout timeout) throws Exception {
tryReconnect(connection, Math.min(BACKOFF_CAP, attempts + 1));
}
}, timeout, TimeUnit.MILLISECONDS);
try {
timer.newTimeout(new TimerTask() {
@Override
public void run(Timeout timeout) throws Exception {
tryReconnect(connection, Math.min(BACKOFF_CAP, attempts + 1));
}
}, timeout, TimeUnit.MILLISECONDS);
} catch (IllegalStateException e) {
// skip
}
}
private void tryReconnect(final RedisConnection connection, final int nextAttempt) {

Loading…
Cancel
Save