diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/ConnectionManager.java b/solr/solrj/src/java/org/apache/solr/common/cloud/ConnectionManager.java index 2964f68e10d..1f5b06c8fa8 100644 --- a/solr/solrj/src/java/org/apache/solr/common/cloud/ConnectionManager.java +++ b/solr/solrj/src/java/org/apache/solr/common/cloud/ConnectionManager.java @@ -82,18 +82,19 @@ public class ConnectionManager implements Watcher { disconnectedTimer.cancel(); disconnectedTimer = null; } - - disconnectedTimer = new Timer(); - disconnectedTimer.schedule(new TimerTask() { - - @Override - public void run() { - synchronized (ConnectionManager.this) { - likelyExpired = true; + if (!isClosed) { + disconnectedTimer = new Timer(); + disconnectedTimer.schedule(new TimerTask() { + + @Override + public void run() { + synchronized (ConnectionManager.this) { + likelyExpired = true; + } } - } - - }, (long) (client.getZkClientTimeout() * 0.90)); + + }, (long) (client.getZkClientTimeout() * 0.90)); + } connected = false; }