From e8b46f76a7b70559e9e091bfa5c5fcd5cfc3cab7 Mon Sep 17 00:00:00 2001 From: Mark Robert Miller Date: Fri, 3 Jan 2014 19:06:22 +0000 Subject: [PATCH] SOLR-5577: fix possible race on canceling timer on close git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1555204 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/solr/common/cloud/ConnectionManager.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 1f5b06c8fa8..d5c2e688134 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 @@ -177,8 +177,11 @@ public class ConnectionManager implements Watcher { public void close() { this.isClosed = true; this.likelyExpired = true; - if (this.disconnectedTimer != null) { + try { this.disconnectedTimer.cancel(); + } catch (NullPointerException e) { + // fine + } finally { this.disconnectedTimer = null; } }