From 419d644f404afa839c68342fe0526d5e3a473023 Mon Sep 17 00:00:00 2001 From: Mark Robert Miller Date: Sun, 29 Dec 2013 00:14:01 +0000 Subject: [PATCH] SOLR-5577: Don't start a timer on disconnect if we are already closed git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1553981 13f79535-47bb-0310-9956-ffa450edef68 --- .../solr/common/cloud/ConnectionManager.java | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) 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; }