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/15 00:43:45 UTC

[lucene-solr] 01/02: #161- Add a timeout toe SolrQueuedThreadPool.

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 cbf2e161accf6411345a538f5f7955be045589e4
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Tue Jul 14 19:35:00 2020 -0500

    #161- Add a timeout toe SolrQueuedThreadPool.
---
 .../src/java/org/apache/solr/common/util/SolrQueuedThreadPool.java   | 5 +++++
 1 file changed, 5 insertions(+)

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 59c6c0b..fe89147 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
@@ -18,6 +18,7 @@ package org.apache.solr.common.util;
 
 import java.io.Closeable;
 import java.lang.invoke.MethodHandles;
+import java.util.concurrent.TimeUnit;
 
 import org.apache.solr.common.util.ObjectReleaseTracker;
 import org.apache.solr.common.util.SolrNamedThreadFactory;
@@ -67,7 +68,11 @@ public class SolrQueuedThreadPool extends QueuedThreadPool implements Closeable
 //    }
 
     public void close() {
+        TimeOut timeout = new TimeOut(5, TimeUnit.SECONDS, TimeSource.NANO_TIME);
         while (getBusyThreads() != 0) {
+            if (timeout.hasTimedOut()) {
+                throw new RuntimeException("Timed out waiting for SolrQueuedThreadPool to close");
+            }
             try {
                 synchronized (notify) {
                     notify.wait(500);