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 05:02:20 UTC
[lucene-solr] 02/06: @413 Reorder this close.
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
commit 33d969436cebde3232242ae86ec91b893fe6b85e
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);
}