From 42d6df57525d589c763746d4ae431b49953755ab Mon Sep 17 00:00:00 2001 From: Nikita Date: Thu, 27 Jul 2017 14:52:09 +0300 Subject: [PATCH] ConnectionWatchdog should handle timer's IllegalStateException properly --- .../client/handler/ConnectionWatchdog.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/redisson/src/main/java/org/redisson/client/handler/ConnectionWatchdog.java b/redisson/src/main/java/org/redisson/client/handler/ConnectionWatchdog.java index 17dd7bbdb..1098f8b0a 100644 --- a/redisson/src/main/java/org/redisson/client/handler/ConnectionWatchdog.java +++ b/redisson/src/main/java/org/redisson/client/handler/ConnectionWatchdog.java @@ -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) {