From f36d35addb132bde7d8f94bc184ce8d0441aad95 Mon Sep 17 00:00:00 2001 From: "markrmiller@gmail.com" Date: Tue, 14 Jul 2020 12:37:33 -0500 Subject: [PATCH] #152 - Try harder. --- .../org/apache/solr/core/CoreContainer.java | 2 +- .../java/org/apache/solr/SolrTestCase.java | 20 ++++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/solr/core/src/java/org/apache/solr/core/CoreContainer.java b/solr/core/src/java/org/apache/solr/core/CoreContainer.java index bbcfba6b5982..c9a5aa144ef8 100644 --- a/solr/core/src/java/org/apache/solr/core/CoreContainer.java +++ b/solr/core/src/java/org/apache/solr/core/CoreContainer.java @@ -193,7 +193,7 @@ public CoreLoadFailure(CoreDescriptor cd, Exception loadFailure) { private volatile UpdateShardHandler updateShardHandler; - private volatile static ThreadPoolExecutor solrCoreLoadExecutor; + public volatile static ThreadPoolExecutor solrCoreLoadExecutor; private final OrderedExecutor replayUpdatesExecutor; 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 7d45bef5d6a2..6312e149bb87 100644 --- a/solr/test-framework/src/java/org/apache/solr/SolrTestCase.java +++ b/solr/test-framework/src/java/org/apache/solr/SolrTestCase.java @@ -34,7 +34,9 @@ import org.apache.solr.client.solrj.impl.HttpClientUtil; import org.apache.solr.cloud.autoscaling.ScheduledTriggers; import org.apache.solr.common.TimeTracker; +import org.apache.solr.common.util.ExecutorUtil; import org.apache.solr.common.util.ObjectReleaseTracker; +import org.apache.solr.core.CoreContainer; import org.apache.solr.servlet.SolrDispatchFilter; import org.apache.solr.util.ExternalPaths; import org.apache.solr.util.RandomizeSSL; @@ -320,12 +322,16 @@ public void checkSyspropForceBeforeAssumptionFailure() { @AfterClass public static void afterSolrTestCase() throws Exception { try { - if (suiteFailureMarker.wasSuccessful()) { - // if the tests passed, make sure everything was closed / released - String orr = ObjectReleaseTracker.checkEmpty(); - ObjectReleaseTracker.clear(); - assertNull(orr, orr); - }} finally { + ExecutorUtil.shutdownAndAwaitTermination(CoreContainer.solrCoreLoadExecutor); + CoreContainer.solrCoreLoadExecutor = null; + + if (suiteFailureMarker.wasSuccessful()) { + // if the tests passed, make sure everything was closed / released + String orr = ObjectReleaseTracker.checkEmpty(); + ObjectReleaseTracker.clear(); + assertNull(orr, orr); + } + } finally { ObjectReleaseTracker.OBJECTS.clear(); TestInjection.reset(); } @@ -352,7 +358,7 @@ public static void afterSolrTestCase() throws Exception { Long tooLongTime = 0L; try { synchronized (TimeTracker.CLOSE_TIMES) { - Map closeTimes = TimeTracker.CLOSE_TIMES; + Map closeTimes = TimeTracker.CLOSE_TIMES; for (TimeTracker closeTime : closeTimes.values()) { // if (closeTime.getClazz() == SolrCore.class) { // continue;