lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hoss...@apache.org
Subject [1/2] lucene-solr:master: SOLR-13043: cleanup suspicious ExecutorService lifecycles in MiniSolrCloudCluster
Date Fri, 14 Dec 2018 03:58:47 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/master d3ee925bd -> 774e9aefb


SOLR-13043: cleanup suspicious ExecutorService lifecycles in MiniSolrCloudCluster


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/df07fb33
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/df07fb33
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/df07fb33

Branch: refs/heads/master
Commit: df07fb33bb2ea0ece6ad9229a50c9661d710fdbe
Parents: f844461
Author: Chris Hostetter <hossman@apache.org>
Authored: Thu Dec 13 19:59:35 2018 -0700
Committer: Chris Hostetter <hossman@apache.org>
Committed: Thu Dec 13 19:59:35 2018 -0700

----------------------------------------------------------------------
 .../apache/solr/cloud/MiniSolrCloudCluster.java  | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/df07fb33/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java
----------------------------------------------------------------------
diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java
b/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java
index 9b52b80..fd719ed 100644
--- a/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java
+++ b/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java
@@ -122,9 +122,6 @@ public class MiniSolrCloudCluster {
   private final CloudSolrClient solrClient;
   private final JettyConfig jettyConfig;
 
-  private final ExecutorService executorLauncher = ExecutorUtil.newMDCAwareCachedThreadPool(new
SolrjNamedThreadFactory("jetty-launcher"));
-  private final ExecutorService executorCloser = ExecutorUtil.newMDCAwareCachedThreadPool(new
SolrjNamedThreadFactory("jetty-closer"));
-  
   private final AtomicInteger nodeIds = new AtomicInteger();
 
   /**
@@ -272,7 +269,9 @@ public class MiniSolrCloudCluster {
       startups.add(() -> startJettySolrRunner(newNodeName(), jettyConfig.context, jettyConfig));
     }
 
+    final ExecutorService executorLauncher = ExecutorUtil.newMDCAwareCachedThreadPool(new
SolrjNamedThreadFactory("jetty-launcher"));
     Collection<Future<JettySolrRunner>> futures = executorLauncher.invokeAll(startups);
+    ExecutorUtil.shutdownAndAwaitTermination(executorLauncher);
     Exception startupError = checkForExceptions("Error starting up MiniSolrCloudCluster",
futures);
     if (startupError != null) {
       try {
@@ -294,10 +293,6 @@ public class MiniSolrCloudCluster {
 
   private void waitForAllNodes(int numServers, int timeoutSeconds) throws IOException, InterruptedException,
TimeoutException {
     
-    executorLauncher.shutdown();
-    
-    ExecutorUtil.shutdownAndAwaitTermination(executorLauncher);
-    
     int numRunning = 0;
     TimeOut timeout = new TimeOut(30, TimeUnit.SECONDS, TimeSource.NANO_TIME);
     
@@ -327,10 +322,6 @@ public class MiniSolrCloudCluster {
   public void waitForNode(JettySolrRunner jetty, int timeoutSeconds)
       throws IOException, InterruptedException, TimeoutException {
 
-    executorLauncher.shutdown();
-
-    ExecutorUtil.shutdownAndAwaitTermination(executorLauncher);
-
     ZkStateReader reader = getSolrClient().getZkStateReader();
 
     reader.waitForLiveNodes(30, TimeUnit.SECONDS, (o, n) -> n.contains(jetty.getNodeName()));
@@ -577,21 +568,19 @@ public class MiniSolrCloudCluster {
     try {
     
       IOUtils.closeQuietly(solrClient);
-      // accept no new tasks
-      executorLauncher.shutdown();
       List<Callable<JettySolrRunner>> shutdowns = new ArrayList<>(jettys.size());
       for (final JettySolrRunner jetty : jettys) {
         shutdowns.add(() -> stopJettySolrRunner(jetty));
       }
       jettys.clear();
+      final ExecutorService executorCloser = ExecutorUtil.newMDCAwareCachedThreadPool(new
SolrjNamedThreadFactory("jetty-closer"));
       Collection<Future<JettySolrRunner>> futures = executorCloser.invokeAll(shutdowns);
+      ExecutorUtil.shutdownAndAwaitTermination(executorCloser);
       Exception shutdownError = checkForExceptions("Error shutting down MiniSolrCloudCluster",
futures);
       if (shutdownError != null) {
         throw shutdownError;
       }
     } finally {
-      ExecutorUtil.shutdownAndAwaitTermination(executorLauncher);
-      ExecutorUtil.shutdownAndAwaitTermination(executorCloser);
       try {
         if (!externalZkServer) {
           zkServer.shutdown();


Mime
View raw message