From 806ab343c6988e7ffd15b62a2c4b7e059bbcc20d Mon Sep 17 00:00:00 2001 From: Mark Robert Miller Date: Fri, 8 Feb 2013 21:44:40 +0000 Subject: [PATCH] SOLR-4421: On CoreContainer shutdown, all SolrCores should publish their state as DOWN. git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1444249 13f79535-47bb-0310-9956-ffa450edef68 --- solr/CHANGES.txt | 3 +++ .../java/org/apache/solr/core/CoreContainer.java | 15 +++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 12a939ded17..b21a56c6125 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -146,6 +146,9 @@ Other Changes * SOLR-4384: Make post.jar report timing information (Upayavira via janhoy) +* SOLR-4421: On CoreContainer shutdown, all SolrCores should publish their + state as DOWN. (Mark Miller) + ================== 4.1.0 ================== Versions of Major Components diff --git a/solr/core/src/java/org/apache/solr/core/CoreContainer.java b/solr/core/src/java/org/apache/solr/core/CoreContainer.java index ec97c5b45e3..44dd5a79c9a 100644 --- a/solr/core/src/java/org/apache/solr/core/CoreContainer.java +++ b/solr/core/src/java/org/apache/solr/core/CoreContainer.java @@ -743,6 +743,7 @@ public class CoreContainer isShutDown = true; if (isZooKeeperAware()) { + publishCoresAsDown(); cancelCoreRecoveries(); } try { @@ -783,6 +784,20 @@ public class CoreContainer } } + private void publishCoresAsDown() { + synchronized (cores) { + for (SolrCore core : cores.values()) { + try { + zkController.publish(core.getCoreDescriptor(), ZkStateReader.DOWN); + } catch (KeeperException e) { + log.error("", e); + } catch (InterruptedException e) { + log.error("", e); + } + } + } + } + public void cancelCoreRecoveries() { ArrayList coreStates = new ArrayList(); synchronized (cores) {