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/10/17 19:04:47 UTC

[lucene-solr] 01/02: @1019 Tweak close.

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

commit 1133bad1b769d4ddcf438759f45db9c695d9edb9
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Sat Oct 17 13:55:52 2020 -0500

    @1019 Tweak close.
---
 .../org/apache/solr/cloud/OverseerTaskProcessor.java    | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/solr/core/src/java/org/apache/solr/cloud/OverseerTaskProcessor.java b/solr/core/src/java/org/apache/solr/cloud/OverseerTaskProcessor.java
index 4078432..a977a0a 100644
--- a/solr/core/src/java/org/apache/solr/cloud/OverseerTaskProcessor.java
+++ b/solr/core/src/java/org/apache/solr/cloud/OverseerTaskProcessor.java
@@ -24,7 +24,10 @@ import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentSkipListMap;
+import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.function.Predicate;
 
@@ -360,7 +363,19 @@ public class OverseerTaskProcessor implements Runnable, Closeable {
     isClosed = true;
     if (closeAndDone) {
       for (Future future : taskFutures.values()) {
-        future.cancel(true);
+        future.cancel(false);
+      }
+      for (Future future : taskFutures.values()) {
+        try {
+          future.get(1, TimeUnit.SECONDS);
+        } catch (InterruptedException e) {
+          ParWork.propagateInterrupt(e);
+          throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e);
+        } catch (ExecutionException e) {
+          throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e);
+        } catch (TimeoutException e) {
+          throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e);
+        }
       }
     }