Skip to content

Apache Lucene open-source search software

SOLR-4421: On CoreContainer shutdown, all SolrCores should publish their state as DOWN.

Mark Robert Miller806ab343c698
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<SolrCoreState> coreStates = new ArrayList<SolrCoreState>();
synchronized (cores) {