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/28 03:06:20 UTC

[lucene-solr] branch reference_impl_dev updated: @413 Reorder this 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


The following commit(s) were added to refs/heads/reference_impl_dev by this push:
     new a084e55  @413 Reorder this close.
a084e55 is described below

commit a084e55a56e9cc63afac547fb6df88c801971cf5
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Mon Jul 27 22:05:15 2020 -0500

    @413 Reorder this close.
---
 .../solr/client/solrj/impl/Http2SolrClient.java    | 55 +++++++++++-----------
 1 file changed, 27 insertions(+), 28 deletions(-)

diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java
index 081287c..de243e4 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java
@@ -264,39 +264,38 @@ public class Http2SolrClient extends SolrClient {
   public void close() {
     closeTracker.close();
 
-    if (httpClientExecutor != null) {
-      try {
-        httpClientExecutor.prepareToStop();
-      } catch (Exception e) {
-        ParWork.propegateInterrupt(e);
-        throw new RuntimeException(e);
-      }
-    }
-    // we wait for async requests, so far devs don't want to give sugar for this
-    asyncTracker.waitForCompleteFinal();
-    if (httpClientExecutor != null) {
-      try {
-        httpClientExecutor.waitForStopping();
-      } catch (InterruptedException e) {
-        ParWork.propegateInterrupt(e);
-      }
-    }
     try (ParWork closer = new ParWork(this, true)) {
-
       if (closeClient) {
         closer.collect(() -> {
-            try {
-             // httpClient.setStopTimeout();
-             // httpClientExecutor.doStop();
-              httpClient.stop();
-            } catch (InterruptedException e) {
-              ParWork.propegateInterrupt(e);
-            } catch (Exception e) {
-              ParWork.propegateInterrupt(e);
-            }
+          try {
+            httpClient.stop();
+          } catch (InterruptedException e) {
+            ParWork.propegateInterrupt(e);
+          } catch (Exception e) {
+            ParWork.propegateInterrupt(e);
+          }
         });
       }
-     closer.addCollect("http2SolrClientClose");
+      closer.collect(() -> {
+        if (httpClientExecutor != null) {
+          try {
+            httpClientExecutor.prepareToStop();
+          } catch (Exception e) {
+            ParWork.propegateInterrupt(e);
+            throw new RuntimeException(e);
+          }
+        }
+        // we wait for async requests, so far devs don't want to give sugar for this
+        asyncTracker.waitForCompleteFinal();
+        if (httpClientExecutor != null) {
+          try {
+            httpClientExecutor.waitForStopping();
+          } catch (InterruptedException e) {
+            ParWork.propegateInterrupt(e);
+          }
+        }
+      });
+      closer.addCollect("httpClientExecutor");
     }
     assert ObjectReleaseTracker.release(this);
   }