diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index decef0fa9f0..38fce7171db 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -138,6 +138,9 @@ Bug Fixes * SOLR-5818: distrib search with custom comparator does not quite work correctly (Ryan Ernst) +* SOLR-5834: Overseer threads are only being interrupted and not closed. + (hossman, Mark Miller) + Optimizations ---------------------- * SOLR-1880: Distributed Search skips GET_FIELDS stage if EXECUTE_QUERY diff --git a/solr/core/src/java/org/apache/solr/cloud/Overseer.java b/solr/core/src/java/org/apache/solr/cloud/Overseer.java index 0577d48beab..0704ccccd49 100644 --- a/solr/core/src/java/org/apache/solr/cloud/Overseer.java +++ b/solr/core/src/java/org/apache/solr/cloud/Overseer.java @@ -81,8 +81,8 @@ public class Overseer { //Internal queue where overseer stores events that have not yet been published into cloudstate //If Overseer dies while extracting the main queue a new overseer will start from this queue private final DistributedQueue workQueue; - private volatile boolean isClosed; private Map clusterProps; + private boolean isClosed = false; public ClusterStateUpdater(final ZkStateReader reader, final String myId) { this.zkClient = reader.getZkClient(); @@ -1030,20 +1030,22 @@ public class Overseer { class OverseerThread extends Thread implements ClosableThread { - private volatile boolean isClosed; + protected volatile boolean isClosed; + private ClosableThread thread; - public OverseerThread(ThreadGroup tg, - ClusterStateUpdater clusterStateUpdater) { - super(tg, clusterStateUpdater); + public OverseerThread(ThreadGroup tg, ClosableThread thread) { + super(tg, (Runnable) thread); + this.thread = thread; } - public OverseerThread(ThreadGroup ccTg, - OverseerCollectionProcessor overseerCollectionProcessor, String string) { - super(ccTg, overseerCollectionProcessor, string); + public OverseerThread(ThreadGroup ccTg, ClosableThread thread, String name) { + super(ccTg, (Runnable) thread, name); + this.thread = thread; } @Override public void close() { + thread.close(); this.isClosed = true; } @@ -1084,8 +1086,7 @@ public class Overseer { ThreadGroup ccTg = new ThreadGroup("Overseer collection creation process."); ocp = new OverseerCollectionProcessor(reader, id, shardHandler, adminPath); - ccThread = new OverseerThread(ccTg, ocp, - "Overseer-" + id); + ccThread = new OverseerThread(ccTg, ocp, "Overseer-" + id); ccThread.setDaemon(true); updaterThread.start();