From commits-return-105750-archive-asf-public=cust-asf.ponee.io@lucene.apache.org Fri Dec 14 04:58:51 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 250C1180676 for ; Fri, 14 Dec 2018 04:58:50 +0100 (CET) Received: (qmail 89545 invoked by uid 500); 14 Dec 2018 03:58:50 -0000 Mailing-List: contact commits-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list commits@lucene.apache.org Received: (qmail 89523 invoked by uid 99); 14 Dec 2018 03:58:48 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 Dec 2018 03:58:48 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id C5CB6E1455; Fri, 14 Dec 2018 03:58:47 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: hossman@apache.org To: commits@lucene.apache.org Date: Fri, 14 Dec 2018 03:58:47 -0000 Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: [1/2] lucene-solr:master: SOLR-13043: cleanup suspicious ExecutorService lifecycles in MiniSolrCloudCluster 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 Authored: Thu Dec 13 19:59:35 2018 -0700 Committer: Chris Hostetter 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> 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> 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> 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();