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/07/27 15:08:21 UTC

[lucene-solr] branch reference_impl updated: @383 Try and get this thread leak.

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

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


The following commit(s) were added to refs/heads/reference_impl by this push:
     new ae2093a  @383 Try and get this thread leak.
ae2093a is described below

commit ae2093a02079f6afa8162dd805f2d165ae2f962d
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Mon Jul 27 10:07:55 2020 -0500

    @383 Try and get this thread leak.
---
 solr/solrj/src/java/org/apache/solr/common/ParWork.java          | 9 +++------
 .../solrj/src/java/org/apache/solr/common/util/ExecutorUtil.java | 2 +-
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/solr/solrj/src/java/org/apache/solr/common/ParWork.java b/solr/solrj/src/java/org/apache/solr/common/ParWork.java
index 86883c7..6e71ce8 100644
--- a/solr/solrj/src/java/org/apache/solr/common/ParWork.java
+++ b/solr/solrj/src/java/org/apache/solr/common/ParWork.java
@@ -652,14 +652,11 @@ public class ParWork implements Closeable {
     TimeTracker subTracker = workUnitTracker.startSubClose(object);
     try {
       boolean handled = false;
-      if (object instanceof ExecutorService) {
-        shutdownAndAwaitTermination((ExecutorService) object);
-        handled = true;
-      } else if (object instanceof OrderedExecutor) {
+      if (object instanceof OrderedExecutor) {
         ((OrderedExecutor) object).shutdownAndAwaitTermination();
         handled = true;
-      } else if (object instanceof OrderedExecutor) {
-        ((OrderedExecutor) object).shutdownAndAwaitTermination();
+      } else if (object instanceof ExecutorService) {
+        shutdownAndAwaitTermination((ExecutorService) object);
         handled = true;
       } else if (object instanceof CloseableHttpClient) {
         HttpClientUtil.close((CloseableHttpClient) object);
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 0fb0872..d46caa8 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
@@ -77,7 +77,7 @@ public class ExecutorUtil {
 
   public static void shutdownAndAwaitTermination(ExecutorService pool) {
     if(pool == null) return;
-    pool.shutdown(); // Disable new tasks from being submitted
+    pool.shutdownNow(); // Disable new tasks from being submitted
     awaitTermination(pool);
   }