diff --git a/solr/core/src/java/org/apache/solr/client/solrj/embedded/JettySolrRunner.java b/solr/core/src/java/org/apache/solr/client/solrj/embedded/JettySolrRunner.java index 7260326ef31..1fdc3ea74d9 100644 --- a/solr/core/src/java/org/apache/solr/client/solrj/embedded/JettySolrRunner.java +++ b/solr/core/src/java/org/apache/solr/client/solrj/embedded/JettySolrRunner.java @@ -308,24 +308,11 @@ public class JettySolrRunner { } public void stop() throws Exception { - // we try and do a bunch of extra stop stuff because - // jetty doesn't like to stop if it started - // and ended up in a failure state (like when it cannot get the port) - if (server.getState().equals(Server.FAILED)) { - Connector[] connectors = server.getConnectors(); - for (Connector connector : connectors) { - connector.stop(); - } - } + Filter filter = dispatchFilter.getFilter(); - ThreadPool threadPool = server.getThreadPool(); - server.getServer().stop(); + server.stop(); - if (threadPool instanceof QueuedThreadPool) { - ((QueuedThreadPool) threadPool).setMaxStopTimeMs(30000); - ((QueuedThreadPool) threadPool).stop(); - ((QueuedThreadPool) threadPool).join(); - } + //server.destroy(); if (server.getState().equals(Server.FAILED)) { filter.destroy(); diff --git a/solr/core/src/java/org/apache/solr/cloud/SyncStrategy.java b/solr/core/src/java/org/apache/solr/cloud/SyncStrategy.java index 1c265ea0c07..93b8e0e4bc5 100644 --- a/solr/core/src/java/org/apache/solr/cloud/SyncStrategy.java +++ b/solr/core/src/java/org/apache/solr/cloud/SyncStrategy.java @@ -271,7 +271,7 @@ public class SyncStrategy { public void close() { this.isClosed = true; - ExecutorUtil.shutdownNowAndAwaitTermination(recoveryCmdExecutor); + ExecutorUtil.shutdownAndAwaitTermination(recoveryCmdExecutor); } private void requestRecovery(final ZkNodeProps leaderProps, final String baseUrl, final String coreName) throws SolrServerException, IOException { 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 aef07cf61ad..2d6b068ee25 100644 --- a/solr/core/src/java/org/apache/solr/core/CoreContainer.java +++ b/solr/core/src/java/org/apache/solr/core/CoreContainer.java @@ -694,7 +694,7 @@ public class CoreContainer } } finally { if (coreLoadExecutor != null) { - ExecutorUtil.shutdownNowAndAwaitTermination(coreLoadExecutor); + ExecutorUtil.shutdownAndAwaitTermination(coreLoadExecutor); } } } diff --git a/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandlerFactory.java b/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandlerFactory.java index 6e5be383f88..32b173be2fc 100644 --- a/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandlerFactory.java +++ b/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandlerFactory.java @@ -156,7 +156,7 @@ public class HttpShardHandlerFactory extends ShardHandlerFactory implements Plug @Override public void close() { try { - ExecutorUtil.shutdownNowAndAwaitTermination(commExecutor); + ExecutorUtil.shutdownAndAwaitTermination(commExecutor); } catch (Throwable e) { SolrException.log(log, e); } diff --git a/solr/core/src/java/org/apache/solr/update/UpdateLog.java b/solr/core/src/java/org/apache/solr/update/UpdateLog.java index bc761ea41f6..93cf96ba485 100644 --- a/solr/core/src/java/org/apache/solr/update/UpdateLog.java +++ b/solr/core/src/java/org/apache/solr/update/UpdateLog.java @@ -820,7 +820,7 @@ public class UpdateLog implements PluginInfoInitialized { public void close(boolean committed, boolean deleteOnClose) { synchronized (this) { try { - ExecutorUtil.shutdownNowAndAwaitTermination(recoveryExecutor); + ExecutorUtil.shutdownAndAwaitTermination(recoveryExecutor); } catch (Exception e) { SolrException.log(log, e); } diff --git a/solr/core/src/java/org/apache/solr/update/UpdateShardHandler.java b/solr/core/src/java/org/apache/solr/update/UpdateShardHandler.java index c3d1499c8d1..1cd2cc8b7b7 100644 --- a/solr/core/src/java/org/apache/solr/update/UpdateShardHandler.java +++ b/solr/core/src/java/org/apache/solr/update/UpdateShardHandler.java @@ -60,7 +60,7 @@ public class UpdateShardHandler { public void close() { try { - ExecutorUtil.shutdownNowAndAwaitTermination(cmdDistribExecutor); + ExecutorUtil.shutdownAndAwaitTermination(cmdDistribExecutor); } catch (Throwable e) { SolrException.log(log, e); } diff --git a/solr/solrj/src/java/org/apache/solr/common/util/ExecutorUtil.java b/solr/solrj/src/java/org/apache/solr/common/util/ExecutorUtil.java index 0c058c94af4..b74cb7b25d2 100644 --- a/solr/solrj/src/java/org/apache/solr/common/util/ExecutorUtil.java +++ b/solr/solrj/src/java/org/apache/solr/common/util/ExecutorUtil.java @@ -27,6 +27,7 @@ import org.slf4j.LoggerFactory; public class ExecutorUtil { public static Logger log = LoggerFactory.getLogger(ExecutorUtil.class); + // really? lucene/solr do not like to be interrupted public static void shutdownNowAndAwaitTermination(ExecutorService pool) { pool.shutdown(); // Disable new tasks from being submitted pool.shutdownNow(); // Cancel currently executing tasks