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/05 17:03:24 UTC

[lucene-solr] 04/11: @478 Flip this back how it was, we allow join and pump the queue with NOOPs during 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 1f38988612a22337b5b6c114858bf913548d5c72
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Thu Jul 30 22:58:06 2020 -0500

    @478 Flip this back how it was, we allow join and pump the queue with NOOPs during close.
---
 .../apache/solr/client/solrj/impl/Http2SolrClient.java   | 15 ++++++++++-----
 .../apache/solr/common/util/SolrQueuedThreadPool.java    | 16 ++++++++--------
 2 files changed, 18 insertions(+), 13 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 f23a4a2..4242122 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
@@ -266,11 +266,16 @@ public class Http2SolrClient extends SolrClient {
           }
         });
       }
-//      closer.collect(() -> {
-//        // we wait for async requests, so far devs don't want to give sugar for this
-//       // asyncTracker.waitForCompleteFinal();
-//
-//      });
+      closer.collect(() -> {
+
+        try {
+          // will fill queue with NOOPS and wake sleeping threads
+          httpClientExecutor.waitForStopping();
+        } catch (InterruptedException e) {
+          ParWork.propegateInterrupt(e);
+        }
+
+      });
       closer.addCollect("httpClientExecutor");
     }
     assert ObjectReleaseTracker.release(this);
diff --git a/solr/solrj/src/java/org/apache/solr/common/util/SolrQueuedThreadPool.java b/solr/solrj/src/java/org/apache/solr/common/util/SolrQueuedThreadPool.java
index aa6c493..38e16f6 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/SolrQueuedThreadPool.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/SolrQueuedThreadPool.java
@@ -284,14 +284,14 @@ public class SolrQueuedThreadPool extends ContainerLifeCycle implements ThreadFa
 
     private void joinThreads(long stopByNanos) throws InterruptedException
     {
-//        for (Thread thread : _threads)
-//        {
-//            long canWait = TimeUnit.NANOSECONDS.toMillis(stopByNanos - System.nanoTime());
-//            if (LOG.isDebugEnabled())
-//                LOG.debug("Waiting for {} for {}", thread, canWait);
-//            if (canWait > 0)
-//                thread.join(canWait);
-//        }
+        for (Thread thread : _threads)
+        {
+            long canWait = TimeUnit.NANOSECONDS.toMillis(stopByNanos - System.nanoTime());
+            if (LOG.isDebugEnabled())
+                LOG.debug("Waiting for {} for {}", thread, canWait);
+            if (canWait > 0)
+                thread.join(canWait);
+        }
     }
 
     /**