You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2020/08/30 16:43:10 UTC

[lucene-solr] branch reference_impl_dev updated: @634 Tighten up.

This is an automated email from the ASF dual-hosted git repository.

markrmiller pushed a commit to branch reference_impl_dev
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/reference_impl_dev by this push:
     new 2bbb61b  @634 Tighten up.
2bbb61b is described below

commit 2bbb61b0827a06a7f3a6997c0792be3b44bf0729
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Sun Aug 30 11:42:20 2020 -0500

    @634 Tighten up.
---
 .../solr/common/util/SolrScheduledExecutorScheduler.java       | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/solr/solrj/src/java/org/apache/solr/common/util/SolrScheduledExecutorScheduler.java b/solr/solrj/src/java/org/apache/solr/common/util/SolrScheduledExecutorScheduler.java
index f5e2c3a..078930c 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/SolrScheduledExecutorScheduler.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/SolrScheduledExecutorScheduler.java
@@ -85,6 +85,7 @@ public class SolrScheduledExecutorScheduler extends AbstractLifeCycle implements
   @Override
   protected void doStart() throws Exception {
     int size = threads > 0 ? threads : 1;
+    assert  scheduler == null;
     scheduler = new ScheduledThreadPoolExecutor(size, r -> {
       Thread thread = SolrScheduledExecutorScheduler.this.thread = new Thread(threadGroup, r, name + "-" + count.incrementAndGet());
       thread.setDaemon(daemon);
@@ -97,9 +98,12 @@ public class SolrScheduledExecutorScheduler extends AbstractLifeCycle implements
 
   @Override
   protected void doStop() throws Exception {
-    scheduler.shutdownNow();
-    super.doStop();
-    ExecutorUtil.awaitTermination(scheduler);
+    ScheduledThreadPoolExecutor fscheduler = scheduler;
+    if (fscheduler != null) {
+      fscheduler.shutdownNow();
+      super.doStop();
+      ExecutorUtil.awaitTermination(fscheduler);
+    }
     scheduler = null;
   }