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/10 16:31:27 UTC

[lucene-solr] branch reference_impl updated: #51 Don't stop jetty threads between tests.

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


The following commit(s) were added to refs/heads/reference_impl by this push:
     new 8e01359  #51 Don't stop jetty threads between tests.
8e01359 is described below

commit 8e013596198a72950ca7239e9473be70321399cd
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Fri Jul 10 11:31:03 2020 -0500

    #51 Don't stop jetty threads between tests.
---
 .../solrj/embedded/SolrQueuedThreadPool.java       | 24 +++++++++-------------
 .../src/java/org/apache/solr/SolrTestCase.java     |  4 ++--
 .../src/java/org/apache/solr/SolrTestCaseJ4.java   |  4 ++--
 3 files changed, 14 insertions(+), 18 deletions(-)

diff --git a/solr/core/src/java/org/apache/solr/client/solrj/embedded/SolrQueuedThreadPool.java b/solr/core/src/java/org/apache/solr/client/solrj/embedded/SolrQueuedThreadPool.java
index 92be062..d5ab29b 100644
--- a/solr/core/src/java/org/apache/solr/client/solrj/embedded/SolrQueuedThreadPool.java
+++ b/solr/core/src/java/org/apache/solr/client/solrj/embedded/SolrQueuedThreadPool.java
@@ -34,6 +34,7 @@ public class SolrQueuedThreadPool extends QueuedThreadPool implements Closeable
     private final boolean killStop;
     private final String name;
     private volatile Error error;
+    private final Object notify = new Object();
 
 
 
@@ -53,6 +54,9 @@ public class SolrQueuedThreadPool extends QueuedThreadPool implements Closeable
             log.error("Error in Jetty thread pool thread", error);
             this.error = error;
         }
+        synchronized (notify) {
+            notify.notifyAll();
+        }
     }
 
 
@@ -67,23 +71,15 @@ public class SolrQueuedThreadPool extends QueuedThreadPool implements Closeable
 //    }
 
     public void close() {
-        //  while (!isStopped()) {
+        while (getBusyThreads() != 0) {
             try {
-
-                setStopTimeout(1);
-                super.doStop();
-//                // this allows 15 seconds until we start interrupting
-//                Thread.sleep(250);
-
-                // now we wait up 30 seconds gracefully, then interrupt again before waiting for the rest of the timeout
-
+                synchronized (notify) {
+                    notify.wait(500);
+                }
             } catch (InterruptedException e) {
-                ParWork.propegateInterrupt(e);
-                throw new RuntimeException(e);
-            } catch (Exception e) {
-                throw new RuntimeException(e);
+                Thread.currentThread().interrupt();
             }
-      //  }
+        }
 
         if (error != null) {
             throw error;
diff --git a/solr/test-framework/src/java/org/apache/solr/SolrTestCase.java b/solr/test-framework/src/java/org/apache/solr/SolrTestCase.java
index e8b10dd..f04577d 100644
--- a/solr/test-framework/src/java/org/apache/solr/SolrTestCase.java
+++ b/solr/test-framework/src/java/org/apache/solr/SolrTestCase.java
@@ -198,7 +198,7 @@ public class SolrTestCase extends LuceneTestCase {
 
       System.setProperty("solr.maxContainerThreads", "10000");
       System.setProperty("solr.lowContainerThreadsThreshold", "-1");
-      System.setProperty("solr.minContainerThreads", "10");
+      System.setProperty("solr.minContainerThreads", "20");
 
       ScheduledTriggers.DEFAULT_COOLDOWN_PERIOD_SECONDS = 1;
       ScheduledTriggers.DEFAULT_ACTION_THROTTLE_PERIOD_SECONDS =1;
@@ -217,7 +217,7 @@ public class SolrTestCase extends LuceneTestCase {
       System.setProperty("solr.so_commit_timeout.default", "15000");
       System.setProperty("solr.httpclient.defaultConnectTimeout", "10000");
       System.setProperty("solr.httpclient.defaultSoTimeout", "15000");
-      // System.setProperty("solr.containerThreadsIdle", "30000"); no need to set, happens based on defaultSoTimeout
+      // System.setProperty("solr.containerThreadsIdle", "30000"); no need to set
 
       System.setProperty("solr.indexfetcher.sotimeout", "15000");
       System.setProperty("solr.indexfetch.so_timeout.default", "15000");
diff --git a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java
index e9d40e0..6a520de 100644
--- a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java
+++ b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java
@@ -3026,8 +3026,8 @@ public abstract class SolrTestCaseJ4 extends SolrTestCase {
           qtp.setName("solr-test-qtp");
           qtp.setMaxThreads(Integer.getInteger("solr.maxContainerThreads", 10000));
           qtp.setLowThreadsThreshold(Integer.getInteger("solr.lowContainerThreadsThreshold", -1)); // we don't use this or connections will get cut
-          qtp.setMinThreads(Integer.getInteger("solr.minContainerThreads", 4));
-          qtp.setIdleTimeout(Integer.getInteger("solr.containerThreadsIdle", 5000));
+          qtp.setMinThreads(Integer.getInteger("solr.minContainerThreads", 6));
+          qtp.setIdleTimeout(Integer.getInteger("solr.containerThreadsIdle", 15000));
 
           qtp.setStopTimeout((int) TimeUnit.MINUTES.toMillis(2));
           qtp.setReservedThreads(-1); // -1 auto sizes, important to keep