lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markrmil...@apache.org
Subject [02/26] lucene-solr:starburst: The Star Burst Upgrade - a work in progress - the branch gets replaced often.
Date Sun, 29 Jul 2018 15:08:24 GMT
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/74a9b54c/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamingTest.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamingTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamingTest.java
index 9ee6688..c97766f 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamingTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamingTest.java
@@ -64,6 +64,7 @@ import org.junit.Test;
 **/
 
 @LuceneTestCase.SuppressCodecs({"Lucene3x", "Lucene40","Lucene41","Lucene42","Lucene45"})
+@Ignore // nocommit
 public class StreamingTest extends SolrCloudTestCase {
 
 public static final String COLLECTIONORALIAS = "streams";

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/74a9b54c/solr/solrj/src/test/org/apache/solr/client/solrj/request/SchemaTest.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/request/SchemaTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/request/SchemaTest.java
index 75301df..85f0900 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/request/SchemaTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/request/SchemaTest.java
@@ -16,6 +16,10 @@
  */
 package org.apache.solr.client.solrj.request;
 
+import static org.hamcrest.CoreMatchers.anyOf;
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.is;
+
 import java.io.File;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -28,8 +32,10 @@ import java.util.SortedMap;
 import java.util.TreeMap;
 
 import org.apache.commons.io.FileUtils;
+import org.apache.lucene.util.TimeUnits;
+import org.apache.lucene.util.LuceneTestCase.Slow;
 import org.apache.solr.client.solrj.SolrClient;
-import org.apache.solr.client.solrj.impl.HttpSolrClient;
+import org.apache.solr.client.solrj.impl.Http2SolrClient;
 import org.apache.solr.client.solrj.request.schema.AnalyzerDefinition;
 import org.apache.solr.client.solrj.request.schema.FieldTypeDefinition;
 import org.apache.solr.client.solrj.request.schema.SchemaRequest;
@@ -47,14 +53,14 @@ import org.junit.Before;
 import org.junit.Test;
 import org.restlet.ext.servlet.ServerServlet;
 
-import static org.hamcrest.CoreMatchers.anyOf;
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.hamcrest.CoreMatchers.is;
+import com.carrotsearch.randomizedtesting.annotations.TimeoutSuite;
 
 /**
  * Test the functionality (accuracy and failure) of the methods exposed by the classes
  * {@link SchemaRequest} and {@link SchemaResponse}.
  */
+@Slow
+@TimeoutSuite(millis = 60 * TimeUnits.SECOND)
 public class SchemaTest extends RestTestBase {
   private static void assertValidSchemaResponse(SolrResponseBase schemaResponse) {
     assertEquals("Response contained errors: " + schemaResponse.toString(), 0, schemaResponse.getStatus());
@@ -62,7 +68,7 @@ public class SchemaTest extends RestTestBase {
   }
   
   private static void assertFailedSchemaResponse(ThrowingRunnable runnable, String expectedErrorMessage) {
-    HttpSolrClient.RemoteExecutionException e = expectThrows(HttpSolrClient.RemoteExecutionException.class, runnable);
+    Http2SolrClient.RemoteExecutionException e = expectThrows(Http2SolrClient.RemoteExecutionException.class, runnable);
     SimpleOrderedMap errorMap = (SimpleOrderedMap)e.getMetaData().get("error");
     assertEquals("org.apache.solr.api.ApiBag$ExceptionWithErrObject",
         ((NamedList)errorMap.get("metadata")).get("error-class"));

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/74a9b54c/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestUpdateRequestCodec.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestUpdateRequestCodec.java b/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestUpdateRequestCodec.java
index df7beea..18fbfbd 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestUpdateRequestCodec.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestUpdateRequestCodec.java
@@ -18,8 +18,8 @@ package org.apache.solr.client.solrj.request;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
 import java.io.IOException;
+import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashSet;
@@ -27,13 +27,13 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
-import junit.framework.Assert;
-
-import org.apache.lucene.util.LuceneTestCase;
+import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.common.SolrInputDocument;
 import org.apache.solr.common.SolrInputField;
 import org.junit.Test;
 
+import junit.framework.Assert;
+
 /**
  * Test for UpdateRequestCodec
  *
@@ -41,7 +41,7 @@ import org.junit.Test;
  *
  * @see org.apache.solr.client.solrj.request.UpdateRequest
  */
-public class TestUpdateRequestCodec extends LuceneTestCase {
+public class TestUpdateRequestCodec extends SolrTestCaseJ4 {
 
   @Test
   public void simple() throws IOException {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/74a9b54c/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestV1toV2ApiMapper.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestV1toV2ApiMapper.java b/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestV1toV2ApiMapper.java
index 21806da..2114c85 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestV1toV2ApiMapper.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestV1toV2ApiMapper.java
@@ -26,7 +26,9 @@ import org.apache.solr.client.solrj.impl.BinaryRequestWriter;
 import org.apache.solr.client.solrj.request.CollectionAdminRequest.Create;
 import org.apache.solr.common.util.ContentStreamBase;
 import org.apache.solr.common.util.Utils;
+import org.junit.Ignore;
 
+@Ignore // nocommit 
 public class TestV1toV2ApiMapper extends LuceneTestCase {
 
   public void testCreate() throws IOException {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/74a9b54c/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestV2Request.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestV2Request.java b/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestV2Request.java
index c1352e2..b7f252c 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestV2Request.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestV2Request.java
@@ -23,7 +23,7 @@ import java.util.List;
 import org.apache.solr.client.solrj.SolrClient;
 import org.apache.solr.client.solrj.SolrRequest;
 import org.apache.solr.client.solrj.SolrServerException;
-import org.apache.solr.client.solrj.impl.HttpSolrClient;
+import org.apache.solr.client.solrj.impl.Http2SolrClient;
 import org.apache.solr.cloud.SolrCloudTestCase;
 import org.apache.solr.common.util.NamedList;
 import org.junit.BeforeClass;
@@ -58,7 +58,7 @@ public class TestV2Request extends SolrCloudTestCase {
   @Test
   @BadApple(bugUrl="https://issues.apache.org/jira/browse/SOLR-12028")
   public void testHttpSolrClient() throws Exception {
-    HttpSolrClient solrClient = new HttpSolrClient.Builder(
+    Http2SolrClient solrClient = new Http2SolrClient.Builder(
         cluster.getJettySolrRunner(0).getBaseUrl().toString()).build();
     doTest(solrClient);
     solrClient.close();

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/74a9b54c/solr/solrj/src/test/org/apache/solr/client/solrj/response/NoOpResponseParserTest.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/response/NoOpResponseParserTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/response/NoOpResponseParserTest.java
index cda751d..7a48f58 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/response/NoOpResponseParserTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/response/NoOpResponseParserTest.java
@@ -31,7 +31,7 @@ import org.apache.solr.client.solrj.ResponseParser;
 import org.apache.solr.client.solrj.SolrClient;
 import org.apache.solr.client.solrj.SolrQuery;
 import org.apache.solr.client.solrj.SolrServerException;
-import org.apache.solr.client.solrj.impl.HttpSolrClient;
+import org.apache.solr.client.solrj.impl.Http2SolrClient;
 import org.apache.solr.client.solrj.impl.NoOpResponseParser;
 import org.apache.solr.client.solrj.impl.XMLResponseParser;
 import org.apache.solr.client.solrj.request.QueryRequest;
@@ -74,7 +74,7 @@ public class NoOpResponseParserTest extends SolrJettyTestBase {
   @Test
   public void testQueryParse() throws Exception {
 
-    try (HttpSolrClient client = (HttpSolrClient) createNewSolrClient()) {
+    try (Http2SolrClient client = (Http2SolrClient) createNewSolrClient()) {
       SolrQuery query = new SolrQuery("id:1234");
       QueryRequest req = new QueryRequest(query);
       client.setParser(new NoOpResponseParser());

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/74a9b54c/solr/solrj/src/test/org/apache/solr/client/solrj/response/QueryResponseTest.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/response/QueryResponseTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/response/QueryResponseTest.java
index a567116..6aae64b 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/response/QueryResponseTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/response/QueryResponseTest.java
@@ -24,22 +24,23 @@ import java.time.Instant;
 import java.util.Date;
 import java.util.List;
 
-import junit.framework.Assert;
-import org.apache.lucene.util.LuceneTestCase;
 import org.apache.lucene.util.TestRuleLimitSysouts.Limit;
+import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.client.solrj.impl.XMLResponseParser;
 import org.apache.solr.common.SolrDocumentList;
 import org.apache.solr.common.util.NamedList;
 import org.apache.solr.core.SolrResourceLoader;
 import org.junit.Test;
 
+import junit.framework.Assert;
+
 /**
  * A few tests for parsing Solr response in QueryResponse
  * 
  * @since solr 1.3
  */
 @Limit(bytes=20000)
-public class QueryResponseTest extends LuceneTestCase {
+public class QueryResponseTest extends SolrTestCaseJ4 {
   @Test
   public void testRangeFacets() throws Exception {
     XMLResponseParser parser = new XMLResponseParser();

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/74a9b54c/solr/solrj/src/test/org/apache/solr/common/cloud/TestCloudCollectionsListeners.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test/org/apache/solr/common/cloud/TestCloudCollectionsListeners.java b/solr/solrj/src/test/org/apache/solr/common/cloud/TestCloudCollectionsListeners.java
index 60cce59..254cbdd 100644
--- a/solr/solrj/src/test/org/apache/solr/common/cloud/TestCloudCollectionsListeners.java
+++ b/solr/solrj/src/test/org/apache/solr/common/cloud/TestCloudCollectionsListeners.java
@@ -24,6 +24,8 @@ import java.util.Set;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.TimeUnit;
 
+import org.apache.lucene.util.TimeUnits;
+import org.apache.lucene.util.LuceneTestCase.Slow;
 import org.apache.solr.client.solrj.impl.CloudSolrClient;
 import org.apache.solr.client.solrj.request.CollectionAdminRequest;
 import org.apache.solr.cloud.SolrCloudTestCase;
@@ -35,6 +37,10 @@ import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.carrotsearch.randomizedtesting.annotations.TimeoutSuite;
+
+@Slow
+@TimeoutSuite(millis = 90 * TimeUnits.SECOND)
 public class TestCloudCollectionsListeners extends SolrCloudTestCase {
 
   private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/74a9b54c/solr/solrj/src/test/org/apache/solr/common/cloud/TestCollectionStateWatchers.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test/org/apache/solr/common/cloud/TestCollectionStateWatchers.java b/solr/solrj/src/test/org/apache/solr/common/cloud/TestCollectionStateWatchers.java
index c28b6b2..8ce61b3 100644
--- a/solr/solrj/src/test/org/apache/solr/common/cloud/TestCollectionStateWatchers.java
+++ b/solr/solrj/src/test/org/apache/solr/common/cloud/TestCollectionStateWatchers.java
@@ -26,6 +26,8 @@ import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 
+import org.apache.lucene.util.TimeUnits;
+import org.apache.lucene.util.LuceneTestCase.Slow;
 import org.apache.solr.client.solrj.embedded.JettySolrRunner;
 import org.apache.solr.client.solrj.impl.CloudSolrClient;
 import org.apache.solr.client.solrj.request.CollectionAdminRequest;
@@ -38,6 +40,10 @@ import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.carrotsearch.randomizedtesting.annotations.TimeoutSuite;
+
+@Slow
+@TimeoutSuite(millis = 60 * TimeUnits.SECOND)
 public class TestCollectionStateWatchers extends SolrCloudTestCase {
 
   private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@@ -119,7 +125,7 @@ public class TestCollectionStateWatchers extends SolrCloudTestCase {
 
     // shutdown a node and check that we get notified about the change
     final CountDownLatch latch = new CountDownLatch(1);
-    client.registerCollectionStateWatcher("testcollection", (liveNodes, collectionState) -> {
+    client.registerCollectionStateWatcher("testcollection", (closing, liveNodes, collectionState) -> {
       int nodeCount = 0;
       log.info("State changed: {}", collectionState);
       for (Slice slice : collectionState) {
@@ -151,7 +157,7 @@ public class TestCollectionStateWatchers extends SolrCloudTestCase {
         .processAndWait(client, MAX_WAIT_TIMEOUT);
 
     final CountDownLatch latch = new CountDownLatch(1);
-    client.registerCollectionStateWatcher("currentstate", (n, c) -> {
+    client.registerCollectionStateWatcher("currentstate", (closing, n, c) -> {
       latch.countDown();
       return false;
     });
@@ -161,7 +167,7 @@ public class TestCollectionStateWatchers extends SolrCloudTestCase {
         1, client.getZkStateReader().getStateWatchers("currentstate").size());
 
     final CountDownLatch latch2 = new CountDownLatch(1);
-    client.registerCollectionStateWatcher("currentstate", (n, c) -> {
+    client.registerCollectionStateWatcher("currentstate", (closing, n, c) -> {
       latch2.countDown();
       return true;
     });

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/74a9b54c/solr/solrj/src/test/org/apache/solr/common/util/ContentStreamTest.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test/org/apache/solr/common/util/ContentStreamTest.java b/solr/solrj/src/test/org/apache/solr/common/util/ContentStreamTest.java
index 58996e4..55e1042 100644
--- a/solr/solrj/src/test/org/apache/solr/common/util/ContentStreamTest.java
+++ b/solr/solrj/src/test/org/apache/solr/common/util/ContentStreamTest.java
@@ -29,9 +29,11 @@ import java.nio.charset.StandardCharsets;
 import org.apache.commons.io.IOUtils;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.core.SolrResourceLoader;
+import org.junit.Ignore;
 
 /**
  */
+@Ignore // nocommit
 public class ContentStreamTest extends SolrTestCaseJ4 
 {  
   public void testStringStream() throws IOException 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/74a9b54c/solr/solrj/src/test/org/apache/solr/common/util/NamedListTest.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test/org/apache/solr/common/util/NamedListTest.java b/solr/solrj/src/test/org/apache/solr/common/util/NamedListTest.java
index 8605cd9..9a2ae2f 100644
--- a/solr/solrj/src/test/org/apache/solr/common/util/NamedListTest.java
+++ b/solr/solrj/src/test/org/apache/solr/common/util/NamedListTest.java
@@ -20,10 +20,10 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.lucene.util.LuceneTestCase;
+import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.common.SolrException;
 
-public class NamedListTest extends LuceneTestCase {
+public class NamedListTest extends SolrTestCaseJ4 {
   public void testRemove() {
     NamedList<String> nl = new NamedList<>();
     nl.add("key1", "value1");

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/74a9b54c/solr/solrj/src/test/org/apache/solr/common/util/TestFastInputStream.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test/org/apache/solr/common/util/TestFastInputStream.java b/solr/solrj/src/test/org/apache/solr/common/util/TestFastInputStream.java
index a30d7ee..a291448 100644
--- a/solr/solrj/src/test/org/apache/solr/common/util/TestFastInputStream.java
+++ b/solr/solrj/src/test/org/apache/solr/common/util/TestFastInputStream.java
@@ -16,20 +16,24 @@
  */
 package org.apache.solr.common.util;
 
-import org.apache.lucene.util.LuceneTestCase;
-import org.junit.Test;
-
-import java.io.*;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
 import java.util.zip.GZIPInputStream;
 import java.util.zip.GZIPOutputStream;
 
+import org.apache.solr.SolrTestCaseJ4;
+import org.junit.Test;
+
 /**
  * Test for FastInputStream.
  *
  *
  * @see org.apache.solr.common.util.FastInputStream
  */
-public class TestFastInputStream extends LuceneTestCase {
+public class TestFastInputStream extends SolrTestCaseJ4 {
   @Test
   public void testgzip() throws Exception {
     ByteArrayOutputStream b = new ByteArrayOutputStream();

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/74a9b54c/solr/solrj/src/test/org/apache/solr/common/util/TestNamedListCodec.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test/org/apache/solr/common/util/TestNamedListCodec.java b/solr/solrj/src/test/org/apache/solr/common/util/TestNamedListCodec.java
index 5637ec5..fcda8dc 100644
--- a/solr/solrj/src/test/org/apache/solr/common/util/TestNamedListCodec.java
+++ b/solr/solrj/src/test/org/apache/solr/common/util/TestNamedListCodec.java
@@ -16,20 +16,20 @@
  */
 package org.apache.solr.common.util;
 
-import org.apache.lucene.util.LuceneTestCase;
-import org.apache.solr.BaseDistributedSearchTestCase;
-import org.apache.solr.common.SolrDocument;
-import org.apache.solr.common.SolrDocumentList;
-
-import java.io.ByteArrayOutputStream;
 import java.io.ByteArrayInputStream;
-import java.util.List;
-import java.util.Random;
+import java.io.ByteArrayOutputStream;
 import java.util.ArrayList;
-import java.util.Map;
 import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+
+import org.apache.solr.BaseDistributedSearchTestCase;
+import org.apache.solr.SolrTestCaseJ4;
+import org.apache.solr.common.SolrDocument;
+import org.apache.solr.common.SolrDocumentList;
 
-public class TestNamedListCodec  extends LuceneTestCase {
+public class TestNamedListCodec  extends SolrTestCaseJ4 {
   public void testSimple() throws Exception{
 
     NamedList nl = new NamedList();

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/74a9b54c/solr/test-framework/ivy.xml
----------------------------------------------------------------------
diff --git a/solr/test-framework/ivy.xml b/solr/test-framework/ivy.xml
index e203b46..5ce5cd8 100644
--- a/solr/test-framework/ivy.xml
+++ b/solr/test-framework/ivy.xml
@@ -37,6 +37,11 @@
     <dependency org="com.carrotsearch.randomizedtesting" name="junit4-ant" rev="${/com.carrotsearch.randomizedtesting/junit4-ant}" conf="compile;junit4-stdalone" />
     <dependency org="com.carrotsearch.randomizedtesting" name="randomizedtesting-runner" rev="${/com.carrotsearch.randomizedtesting/randomizedtesting-runner}" conf="compile;junit4-stdalone" />
 
+    <dependency org="net.openhft" name="chronicle-threads" rev="1.15.1" />
+    <dependency org="net.openhft" name="chronicle-core" rev="1.15.1" />
+    <dependency org="net.openhft" name="affinity" rev="3.1.7" />
+    <dependency org="net.java.dev.jna" name="jna" rev="4.5.1"/>
+
     <exclude org="*" ext="*" matcher="regexp" type="${ivy.exclude.types}"/> 
   </dependencies>
 </ivy-module>

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/74a9b54c/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java
----------------------------------------------------------------------
diff --git a/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java b/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java
index 253ba40..32c5fc0 100644
--- a/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java
+++ b/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java
@@ -16,7 +16,6 @@
  */
 package org.apache.solr;
 
-import javax.servlet.Filter;
 import java.io.File;
 import java.io.IOException;
 import java.lang.annotation.ElementType;
@@ -38,9 +37,16 @@ import java.util.Properties;
 import java.util.Random;
 import java.util.Set;
 import java.util.SortedMap;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorCompletionService;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Future;
+import java.util.concurrent.SynchronousQueue;
+import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 
-import junit.framework.Assert;
+import javax.servlet.Filter;
+
 import org.apache.commons.io.FileUtils;
 import org.apache.lucene.util.Constants;
 import org.apache.lucene.util.TestUtil;
@@ -49,7 +55,7 @@ import org.apache.solr.client.solrj.SolrResponse;
 import org.apache.solr.client.solrj.SolrServerException;
 import org.apache.solr.client.solrj.embedded.JettyConfig;
 import org.apache.solr.client.solrj.embedded.JettySolrRunner;
-import org.apache.solr.client.solrj.impl.HttpSolrClient;
+import org.apache.solr.client.solrj.impl.Http2SolrClient;
 import org.apache.solr.client.solrj.request.UpdateRequest;
 import org.apache.solr.client.solrj.response.QueryResponse;
 import org.apache.solr.client.solrj.response.UpdateResponse;
@@ -58,7 +64,9 @@ import org.apache.solr.common.SolrDocumentList;
 import org.apache.solr.common.SolrInputDocument;
 import org.apache.solr.common.params.ModifiableSolrParams;
 import org.apache.solr.common.params.SolrParams;
+import org.apache.solr.common.util.ExecutorUtil;
 import org.apache.solr.common.util.NamedList;
+import org.apache.solr.util.DefaultSolrThreadFactory;
 import org.eclipse.jetty.servlet.ServletHolder;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
@@ -69,6 +77,8 @@ import org.junit.runners.model.Statement;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import junit.framework.Assert;
+
 /**
  * Helper base class for distributed search test cases
  *
@@ -89,6 +99,16 @@ import org.slf4j.LoggerFactory;
  * @since solr 1.5
  */
 public abstract class BaseDistributedSearchTestCase extends SolrTestCaseJ4 {
+  
+  protected ExecutorService executor = new ExecutorUtil.MDCAwareThreadPoolExecutor(
+      4,
+      Integer.MAX_VALUE,
+      15, TimeUnit.SECONDS, // terminate idle threads after 15 sec
+      new SynchronousQueue<>(),  // directly hand off tasks
+      new DefaultSolrThreadFactory("BaseDistributedSearchTestCase"),
+      false
+  );
+  
   // TODO: this shouldn't be static. get the random when you need it to avoid sharing.
   public static Random r;
   
@@ -160,6 +180,9 @@ public abstract class BaseDistributedSearchTestCase extends SolrTestCaseJ4 {
     if ("".equals(ctx)) ctx = "/solr";
     if (ctx.endsWith("/")) ctx = ctx.substring(0,ctx.length()-1);;
     if (!ctx.startsWith("/")) ctx = "/" + ctx;
+    
+    // just / is causing url problems
+    if(ctx.equals("/") )  ctx = "/solr";
     return ctx;
   }
 
@@ -225,7 +248,7 @@ public abstract class BaseDistributedSearchTestCase extends SolrTestCaseJ4 {
   // to stress with higher thread counts and requests, make sure the junit
   // xml formatter is not being used (all output will be buffered before
   // transformation to xml and cause an OOM exception).
-  protected int stress = TEST_NIGHTLY ? 2 : 0;
+  protected int stress = 0;
   protected boolean verifyStress = true;
   protected int nThreads = 3;
 
@@ -308,7 +331,7 @@ public abstract class BaseDistributedSearchTestCase extends SolrTestCaseJ4 {
   private boolean distribTearDownCalled = false;
   public void distribTearDown() throws Exception {
     distribTearDownCalled = true;
-    destroyServers();
+    ExecutorUtil.shutdownAndAwaitTermination(executor);
   }
 
   protected JettySolrRunner createControlJetty() throws Exception {
@@ -419,6 +442,8 @@ public abstract class BaseDistributedSearchTestCase extends SolrTestCaseJ4 {
         .withFilters(getExtraRequestFilters())
         .withServlets(getExtraServlets())
         .withSSLConfig(sslConfig)
+        .withHttpClient(getHttpClient())
+        .withJettyQtp(getQtp())
         .build());
 
     jetty.start();
@@ -439,7 +464,7 @@ public abstract class BaseDistributedSearchTestCase extends SolrTestCaseJ4 {
   protected SolrClient createNewSolrClient(int port) {
     try {
       // setup the client...
-      HttpSolrClient client = getHttpSolrClient(buildUrl(port) + "/" + DEFAULT_TEST_CORENAME);
+      Http2SolrClient client = getHttpSolrClient(buildUrl(port) + "/" + DEFAULT_TEST_CORENAME);
       return client;
     }
     catch (Exception ex) {
@@ -608,11 +633,13 @@ public abstract class BaseDistributedSearchTestCase extends SolrTestCaseJ4 {
 
     if (stress > 0) {
       log.info("starting stress...");
-      Thread[] threads = new Thread[nThreads];
+      Set<Future<Object>> pending = new HashSet<>();;
+      ExecutorCompletionService<Object> cs = new ExecutorCompletionService<>(executor);
+      Callable[] threads = new Callable[nThreads];
       for (int i = 0; i < threads.length; i++) {
-        threads[i] = new Thread() {
+        threads[i] = new Callable() {
           @Override
-          public void run() {
+          public Object call() {
             for (int j = 0; j < stress; j++) {
               int which = r.nextInt(clients.size());
               SolrClient client = clients.get(which);
@@ -625,14 +652,22 @@ public abstract class BaseDistributedSearchTestCase extends SolrTestCaseJ4 {
                 throw new RuntimeException(e);
               }
             }
+            return new Object();
           }
         };
-        threads[i].start();
+        pending.add(cs.submit(threads[i]));
       }
-
-      for (Thread thread : threads) {
-        thread.join();
+      
+      while (pending.size() > 0) {
+        Future<Object> future = cs.take();
+        pending.remove(future);
+        future.get();
       }
+     
+//      for (Thread thread : threads) {
+//        thread.join();
+//      }
+
     }
     return rsp;
   }
@@ -987,6 +1022,7 @@ public abstract class BaseDistributedSearchTestCase extends SolrTestCaseJ4 {
 
       @Override
       public void callStatement() throws Throwable {
+        System.out.println("SHARDS FIXED CALL");
         fixShardCount(numShards);
         createServers(numShards);
         RandVal.uniqueValues = new HashSet(); //reset random values

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/74a9b54c/solr/test-framework/src/java/org/apache/solr/SolrIgnoredThreadsFilter.java
----------------------------------------------------------------------
diff --git a/solr/test-framework/src/java/org/apache/solr/SolrIgnoredThreadsFilter.java b/solr/test-framework/src/java/org/apache/solr/SolrIgnoredThreadsFilter.java
index 96b6d31..b59811d 100644
--- a/solr/test-framework/src/java/org/apache/solr/SolrIgnoredThreadsFilter.java
+++ b/solr/test-framework/src/java/org/apache/solr/SolrIgnoredThreadsFilter.java
@@ -16,8 +16,6 @@
  */
 package org.apache.solr;
 
-import org.apache.lucene.search.TimeLimitingCollector.TimerThread;
-
 import com.carrotsearch.randomizedtesting.ThreadFilter;
 
 
@@ -37,26 +35,9 @@ public class SolrIgnoredThreadsFilter implements ThreadFilter {
      */
 
     String threadName = t.getName();
-    if (threadName.equals(TimerThread.THREAD_NAME)) {
-      return true;
-    }
-
-    if (threadName.startsWith("facetExecutor-") || 
-        threadName.startsWith("cmdDistribExecutor-") ||
-        threadName.startsWith("httpShardExecutor-")) {
-      return true;
-    }
-    
-    // This is a bug in ZooKeeper where they call System.exit(11) when
-    // this thread receives an interrupt signal.
-    if (threadName.startsWith("SyncThread")) {
-      return true;
-    }
 
-    // THESE ARE LIKELY BUGS - these threads should be closed!
-    if (threadName.startsWith("Overseer-") ||
-        threadName.startsWith("aliveCheckExecutor-") ||
-        threadName.startsWith("concurrentUpdateScheduler-")) {
+    // Log4j2 async loggers may take a moment
+    if (threadName.startsWith("Log4j2-")) {
       return true;
     }
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/74a9b54c/solr/test-framework/src/java/org/apache/solr/SolrJettyTestBase.java
----------------------------------------------------------------------
diff --git a/solr/test-framework/src/java/org/apache/solr/SolrJettyTestBase.java b/solr/test-framework/src/java/org/apache/solr/SolrJettyTestBase.java
index 7703ecb..1ef46ea 100644
--- a/solr/test-framework/src/java/org/apache/solr/SolrJettyTestBase.java
+++ b/solr/test-framework/src/java/org/apache/solr/SolrJettyTestBase.java
@@ -16,13 +16,20 @@
  */
 package org.apache.solr;
 
+import java.io.File;
+import java.io.OutputStreamWriter;
+import java.lang.invoke.MethodHandles;
+import java.nio.file.Path;
+import java.util.Properties;
+import java.util.SortedMap;
+
 import org.apache.commons.io.FileUtils;
 import org.apache.lucene.util.LuceneTestCase;
 import org.apache.solr.client.solrj.SolrClient;
 import org.apache.solr.client.solrj.embedded.EmbeddedSolrServer;
 import org.apache.solr.client.solrj.embedded.JettyConfig;
 import org.apache.solr.client.solrj.embedded.JettySolrRunner;
-import org.apache.solr.client.solrj.impl.HttpSolrClient;
+import org.apache.solr.client.solrj.impl.Http2SolrClient;
 import org.apache.solr.util.ExternalPaths;
 import org.eclipse.jetty.servlet.ServletHolder;
 import org.junit.After;
@@ -31,13 +38,6 @@ import org.junit.BeforeClass;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.File;
-import java.io.OutputStreamWriter;
-import java.lang.invoke.MethodHandles;
-import java.nio.file.Path;
-import java.util.Properties;
-import java.util.SortedMap;
-
 
 abstract public class SolrJettyTestBase extends SolrTestCaseJ4 
 {
@@ -66,6 +66,8 @@ abstract public class SolrJettyTestBase extends SolrTestCaseJ4
         .stopAtShutdown(stopAtShutdown)
         .withServlets(extraServlets)
         .withSSLConfig(sslConfig)
+        .withHttpClient(getHttpClient())
+        .withJettyQtp(getQtp())
         .build();
 
     Properties nodeProps = new Properties();
@@ -89,7 +91,7 @@ abstract public class SolrJettyTestBase extends SolrTestCaseJ4
   }
 
   public static JettySolrRunner createJetty(String solrHome) throws Exception {
-    return createJetty(solrHome, new Properties(), JettyConfig.builder().withSSLConfig(sslConfig).build());
+    return createJetty(solrHome, new Properties(), JettyConfig.builder().withSSLConfig(sslConfig).withHttpClient(getHttpClient()).withJettyQtp(getQtp()).build());
   }
 
   public static JettySolrRunner createJetty(String solrHome, Properties nodeProperties, JettyConfig jettyConfig) throws Exception {
@@ -152,7 +154,7 @@ abstract public class SolrJettyTestBase extends SolrTestCaseJ4
       try {
         // setup the client...
         String url = jetty.getBaseUrl().toString() + "/" + "collection1";
-        HttpSolrClient client = getHttpSolrClient(url, DEFAULT_CONNECTION_TIMEOUT);
+        Http2SolrClient client = getHttpSolrClient(url, DEFAULT_CONNECTION_TIMEOUT);
         return client;
       }
       catch( Exception ex ) {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/74a9b54c/solr/test-framework/src/java/org/apache/solr/SolrTestCaseHS.java
----------------------------------------------------------------------
diff --git a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseHS.java b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseHS.java
index 2da0c84..99edf2b 100644
--- a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseHS.java
+++ b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseHS.java
@@ -459,6 +459,8 @@ public class SolrTestCaseHS extends SolrTestCaseJ4 {
             .setContext("/solr")
             .setPort(port)
             .withSSLConfig(sslConfig)
+            .withHttpClient(getHttpClient())
+            .withJettyQtp(getQtp())
             .build();
         Properties nodeProperties = new Properties();
         nodeProperties.setProperty("solrconfig", solrconfigFile);

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/74a9b54c/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java
----------------------------------------------------------------------
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 01e2cae..b5286cf 100644
--- a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java
+++ b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java
@@ -16,7 +16,9 @@
  */
 package org.apache.solr;
 
-import javax.xml.xpath.XPathExpressionException;
+import static java.util.Objects.requireNonNull;
+import static org.apache.solr.update.processor.DistributingUpdateProcessorFactory.DISTRIB_UPDATE_PARAM;
+
 import java.io.File;
 import java.io.IOException;
 import java.io.OutputStreamWriter;
@@ -42,6 +44,7 @@ import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.security.SecureRandom;
+import java.security.Security;
 import java.time.Instant;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -62,15 +65,9 @@ import java.util.Set;
 import java.util.concurrent.CopyOnWriteArraySet;
 import java.util.concurrent.TimeUnit;
 
-import com.carrotsearch.randomizedtesting.RandomizedContext;
-import com.carrotsearch.randomizedtesting.RandomizedTest;
-import com.carrotsearch.randomizedtesting.TraceFormatting;
-import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;
-import com.carrotsearch.randomizedtesting.annotations.ThreadLeakLingering;
-import com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;
+import javax.xml.xpath.XPathExpressionException;
 
 import org.apache.commons.io.FileUtils;
-import org.apache.http.client.HttpClient;
 import org.apache.logging.log4j.Level;
 import org.apache.lucene.analysis.MockAnalyzer;
 import org.apache.lucene.analysis.MockTokenizer;
@@ -81,17 +78,20 @@ import org.apache.lucene.util.LuceneTestCase.SuppressFileSystems;
 import org.apache.lucene.util.LuceneTestCase.SuppressSysoutChecks;
 import org.apache.lucene.util.QuickPatchThreadsFilter;
 import org.apache.lucene.util.TestUtil;
+import org.apache.lucene.util.TimeUnits;
 import org.apache.solr.client.solrj.ResponseParser;
 import org.apache.solr.client.solrj.embedded.JettyConfig;
 import org.apache.solr.client.solrj.embedded.JettySolrRunner;
 import org.apache.solr.client.solrj.impl.CloudSolrClient;
 import org.apache.solr.client.solrj.impl.ClusterStateProvider;
 import org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrClient;
+import org.apache.solr.client.solrj.impl.Http2SolrClient;
+import org.apache.solr.client.solrj.impl.Http2SolrClient.Builder;
 import org.apache.solr.client.solrj.impl.HttpClientUtil;
-import org.apache.solr.client.solrj.impl.HttpSolrClient;
-import org.apache.solr.client.solrj.impl.HttpSolrClient.Builder;
 import org.apache.solr.client.solrj.impl.LBHttpSolrClient;
 import org.apache.solr.client.solrj.util.ClientUtils;
+import org.apache.solr.client.solrj.util.SolrInternalHttpClient;
+import org.apache.solr.client.solrj.util.SolrQueuedThreadPool;
 import org.apache.solr.cloud.IpTables;
 import org.apache.solr.cloud.MiniSolrCloudCluster;
 import org.apache.solr.common.SolrDocument;
@@ -106,6 +106,7 @@ import org.apache.solr.common.params.SolrParams;
 import org.apache.solr.common.params.UpdateParams;
 import org.apache.solr.common.util.ContentStream;
 import org.apache.solr.common.util.ContentStreamBase;
+import org.apache.solr.common.util.IOUtils;
 import org.apache.solr.common.util.ObjectReleaseTracker;
 import org.apache.solr.common.util.SuppressForbidden;
 import org.apache.solr.common.util.XML;
@@ -126,6 +127,7 @@ import org.apache.solr.schema.IndexSchema;
 import org.apache.solr.schema.SchemaField;
 import org.apache.solr.search.SolrIndexSearcher;
 import org.apache.solr.servlet.DirectSolrConnection;
+import org.apache.solr.update.processor.DistributedUpdateProcessor.DistribPhase;
 import org.apache.solr.util.LogLevel;
 import org.apache.solr.util.RandomizeSSL;
 import org.apache.solr.util.RandomizeSSL.SSLRandomizer;
@@ -136,6 +138,7 @@ import org.apache.solr.util.StartupLoggingUtils;
 import org.apache.solr.util.TestHarness;
 import org.apache.solr.util.TestInjection;
 import org.apache.zookeeper.KeeperException;
+import org.conscrypt.OpenSSLProvider;
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.Before;
@@ -151,9 +154,13 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.xml.sax.SAXException;
 
-import static java.util.Objects.requireNonNull;
-import static org.apache.solr.update.processor.DistributedUpdateProcessor.DistribPhase;
-import static org.apache.solr.update.processor.DistributingUpdateProcessorFactory.DISTRIB_UPDATE_PARAM;
+import com.carrotsearch.randomizedtesting.RandomizedContext;
+import com.carrotsearch.randomizedtesting.RandomizedTest;
+import com.carrotsearch.randomizedtesting.TraceFormatting;
+import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;
+import com.carrotsearch.randomizedtesting.annotations.ThreadLeakLingering;
+import com.carrotsearch.randomizedtesting.annotations.TimeoutSuite;
+import com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;
 
 /**
  * A junit4 Solr test harness that extends LuceneTestCaseJ4.
@@ -167,7 +174,8 @@ import static org.apache.solr.update.processor.DistributingUpdateProcessorFactor
 @SuppressSysoutChecks(bugUrl = "Solr dumps tons of logs to console.")
 @SuppressFileSystems("ExtrasFS") // might be ok, the failures with e.g. nightly runs might be "normal"
 @RandomizeSSL()
-@ThreadLeakLingering(linger = 80000)
+@TimeoutSuite(millis = 45 * TimeUnits.SECOND)
+@ThreadLeakLingering(linger = 10000)
 public abstract class SolrTestCaseJ4 extends LuceneTestCase {
 
   private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@@ -191,6 +199,81 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
   public static int DEFAULT_CONNECTION_TIMEOUT = 60000;  // default socket connection timeout in ms
   
   private static String initialRootLogLevel;
+  
+  static {
+    // this has to happen in the right class loader
+    try {
+      if (Security.getProvider("Conscrypt") == null) {
+        Security.addProvider(new OpenSSLProvider("Conscrypt"));
+      }
+    } catch(UnsatisfiedLinkError e) {
+      log.error("Could not load SSL Provider due to " + UnsatisfiedLinkError.class.getSimpleName(), e);
+      Throwable[] suppressed = e.getSuppressed();
+      for (Throwable t : suppressed) {
+        log.error("Supressed Throwable:", t);
+      }
+      throw e;
+    } catch (Throwable t) {
+      log.error("Could not load SSL Provider", t);
+      throw t;
+    }
+  }
+  
+ // private static volatile AffinityLock affinityLock = null;
+  
+  private static volatile SolrInternalHttpClient httpClient;
+
+  private static volatile SolrQueuedThreadPool qtp;
+  
+  public static SolrInternalHttpClient getHttpClient() {
+    
+    if (httpClient == null) {
+      synchronized (SolrTestCaseJ4.class) {
+        if (httpClient == null) {
+          httpClient = new SolrInternalHttpClient(SolrTestCaseJ4.class.getSimpleName(), getQtp(), true);
+        }
+      }
+    }
+
+    return httpClient;
+  }
+
+  public static SolrQueuedThreadPool getQtp() {
+    if (qtp == null) {
+      synchronized (SolrTestCaseJ4.class) {
+        if (qtp == null) {
+          String name = "TestServerAndClientQTP-" + getTestClass().getSimpleName();
+          ThreadGroup tg = new ThreadGroup(name);
+          qtp = new SolrQueuedThreadPool(10000, 0, 5000, null, tg) {
+            @Override
+            protected Thread newThread(Runnable runnable) {
+              return new Thread(tg, runnable) {
+                @Override
+                public void run() {
+                  // int i = random().nextInt(Runtime.getRuntime().availableProcessors());
+                  // Affinity.setAffinity(i);
+                  // try (AffinityLock lock = AffinityLock.acquireLock(false)) {
+                  super.run();
+                  // }
+                }
+              };
+
+            }
+          };
+          // qtp.setReservedThreads(0);
+          qtp.setName(name);
+          // qtp.setStopTimeout((int) TimeUnit.MINUTES.toMillis(1));
+          try {
+            qtp.start();
+          } catch (Exception e) {
+            throw new RuntimeException(e);
+          }
+        }
+      }
+    }
+
+    return qtp;
+  }
 
   protected void writeCoreProperties(Path coreDirectory, String corename) throws IOException {
     Properties props = new Properties();
@@ -252,6 +335,7 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
   // thread will read the latest value
   protected static volatile SSLTestConfig sslConfig;
 
+
   @ClassRule
   public static TestRule solrClassRules = 
     RuleChain.outerRule(new SystemPropertiesRestoreRule())
@@ -262,7 +346,15 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
     RuleChain.outerRule(new SystemPropertiesRestoreRule());
 
   @BeforeClass
-  public static void setupTestCases() {
+  public static void setupTestCases() throws Exception {
+    Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
+    System.out.println("SETUPTHREAD:" + Thread.currentThread().getId());
+    //affinityLock = AffinityLock.acquireLock(false, AffinityStrategies.ANY);
+    //affinityLock.bind();
+    //AffinitySupport.setAffinity(1L << 5); (1L << 3);
+    //int i = random().nextInt(Runtime.getRuntime().availableProcessors());
+    //Affinity.setAffinity(i);
+    
     initialRootLogLevel = StartupLoggingUtils.getLogLevelString();
     initClassLogLevels();
     resetExceptionIgnores();
@@ -295,19 +387,28 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
   public static void teardownTestCases() throws Exception {
     try {
       deleteCore();
+      
+      
+      IOUtils.closeQuietly(httpClient);
+      httpClient = null;
+      
+      IOUtils.closeQuietly(qtp);
+      qtp = null;
+
       resetExceptionIgnores();
       
       if (suiteFailureMarker.wasSuccessful()) {
         // if the tests passed, make sure everything was closed / released
         if (!RandomizedContext.current().getTargetClass().isAnnotationPresent(SuppressObjectReleaseTracker.class)) {
-          String orr = clearObjectTrackerAndCheckEmpty(20, false);
+          String orr = clearObjectTrackerAndCheckEmpty(5, false);
           assertNull(orr, orr);
         } else {
-          clearObjectTrackerAndCheckEmpty(20, true);
+          clearObjectTrackerAndCheckEmpty(5, true);
         }
       }
       resetFactory();
       coreName = DEFAULT_TEST_CORENAME;
+
     } finally {
       ObjectReleaseTracker.clear();
       TestInjection.reset();
@@ -328,6 +429,12 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
       // clean up static
       sslConfig = null;
       testSolrHome = null;
+      
+//      try {
+//        affinityLock.close();
+//      } catch (NullPointerException e) {
+//
+//      }
     }
     
     IpTables.unblockAllPorts();
@@ -335,6 +442,51 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
     LogLevel.Configurer.restoreLogLevels(savedClassLogLevels);
     savedClassLogLevels.clear();
     StartupLoggingUtils.changeLogLevel(initialRootLogLevel);
+    
+    // nocommit we need to filter and only do this for known threads? dont want users to count on this behavior unless necessary
+    String testThread = Thread.currentThread().getName();
+    System.out.println("test thread:" + testThread);
+    ThreadGroup tg = Thread.currentThread().getThreadGroup();
+    System.out.println("test group:" + tg.getName());
+    Set<Entry<Thread,StackTraceElement[]>> threadSet = Thread.getAllStackTraces().entrySet();
+    System.out.println("thread count: " + threadSet.size());
+    for (Entry<Thread,StackTraceElement[]> threadEntry : threadSet) {
+      Thread thread = threadEntry.getKey();
+      ThreadGroup threadGroup = thread.getThreadGroup();
+      if (threadGroup != null) {
+        System.out.println("thread group:" + threadGroup.getName());
+        if (threadGroup.getName().equals(tg.getName()) && !thread.getName().startsWith("SUITE") && !thread.getName().startsWith("Log4j2")) {
+          System.out.println("interrupt thread:" + thread.getName());
+
+          interrupt(thread);
+          continue;
+        }
+      }
+      
+      while (threadGroup != null && threadGroup.getParent() != null && !thread.getName().startsWith("SUITE") && !thread.getName().startsWith("Log4j2")) {
+        threadGroup = threadGroup.getParent();
+        if (threadGroup.getName().equals(tg.getName())) {
+          System.out.println("interrupt thread:" + thread.getName());
+          
+          interrupt(thread);
+          continue;
+        }
+      }
+    }
+  }
+
+  private static boolean first = true;
+  private static void interrupt(Thread thread) {
+    if (first) {
+      first = false;
+      try {
+        // give a short chance to end gracefully ?
+        Thread.sleep(100);
+      } catch (InterruptedException e) {
+
+      }
+    }
+    thread.interrupt();    
   }
   
   /** Assumes that Mockito/Bytebuddy is available and can be used to mock classes (e.g., fails if Java version is too new). */
@@ -365,7 +517,7 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
     String result;
     do {
       result = ObjectReleaseTracker.checkEmpty();
-      if (result == null)
+      if (result == null || RandomizedContext.current().getTargetClass().isAnnotationPresent(SuppressObjectReleaseTracker.class))
         break;
       try {
         if (retries % 10 == 0) {
@@ -463,24 +615,47 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
 
   private static SSLTestConfig buildSSLConfig() {
 
-    SSLRandomizer sslRandomizer =
-      SSLRandomizer.getSSLRandomizerForClass(RandomizedContext.current().getTargetClass());
-    
+    SSLRandomizer sslRandomizer = SSLRandomizer.getSSLRandomizerForClass(RandomizedContext.current().getTargetClass());
+
     if (Constants.MAC_OS_X) {
       // see SOLR-9039
       // If a solution is found to remove this, please make sure to also update
       // TestMiniSolrCloudClusterSSL.testSslAndClientAuth as well.
-      sslRandomizer = new SSLRandomizer(sslRandomizer.ssl, 0.0D, (sslRandomizer.debug + " w/ MAC_OS_X supressed clientAuth"));
+      sslRandomizer = new SSLRandomizer(sslRandomizer.ssl, 0.0D,
+          (sslRandomizer.debug + " w/ MAC_OS_X supressed clientAuth"));
     }
 
     SSLTestConfig result = sslRandomizer.createSSLTestConfig();
+
+    // nocommit system props
+    if (result.isSSLMode()) {
+      if (result.getKeyStore() != null) {
+        System.setProperty("javax.net.ssl.keyStore", result.getKeyStore());
+      }
+      if (result.getKeyStore() != null) {
+        System.setProperty("javax.net.ssl.keyStorePassword", result.getKeyStorePassword());
+      }
+      if (result.isClientAuthMode()) {
+        System.setProperty("org.apache.solr.ssl.enabled", "true");
+        if (result.getTrustStore() != null) {
+          System.setProperty("javax.net.ssl.trustStore", result.getTrustStore());
+        }
+        if (result.getTrustStorePassword() != null) {
+          System.setProperty("javax.net.ssl.trustStorePassword", result.getTrustStorePassword());
+        }
+      } else {
+        System.setProperty("org.apache.solr.ssl.enabled", "false");
+      }
+
+    }
+    
     log.info("Randomized ssl ({}) and clientAuth ({}) via: {}",
              result.isSSLMode(), result.isClientAuthMode(), sslRandomizer.debug);
     return result;
   }
 
   protected static JettyConfig buildJettyConfig(String context) {
-    return JettyConfig.builder().setContext(context).withSSLConfig(sslConfig).build();
+    return JettyConfig.builder().setContext(context).withSSLConfig(sslConfig).withHttpClient(getHttpClient()).withJettyQtp(getQtp()).build();
   }
   
   protected static String buildUrl(final int port, final String context) {
@@ -550,6 +725,7 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
   public void setUp() throws Exception {
     super.setUp();
     log.info("###Starting " + getTestName());  // returns <unknown>???
+    
   }
 
   @Override
@@ -2314,7 +2490,8 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
    * {@link org.apache.solr.client.solrj.impl.CloudSolrClient.Builder} class directly
    */ 
   public static CloudSolrClient getCloudSolrClient(String zkHost) {
-    return new CloudSolrClientBuilder(Collections.singletonList(zkHost), Optional.empty()).build();
+    return new CloudSolrClientBuilder(Collections.singletonList(zkHost), Optional.empty())
+        .withHttpClient(getHttpClient()).build();
   }
 
   /**
@@ -2323,7 +2500,7 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
    * {@link org.apache.solr.client.solrj.impl.CloudSolrClient.Builder} class directly
    */
   public static CloudSolrClient getCloudSolrClient(MiniSolrCloudCluster cluster) {
-    return new CloudSolrClientBuilder(cluster).build();
+    return new CloudSolrClientBuilder(cluster).withHttpClient(getHttpClient()).build();
   }
 
   /**
@@ -2331,7 +2508,7 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
    * Tests that do not wish to have any randomized behavior should use the 
    * {@link org.apache.solr.client.solrj.impl.CloudSolrClient.Builder} class directly
    */ 
-  public static CloudSolrClient getCloudSolrClient(String zkHost, HttpClient httpClient) {
+  public static CloudSolrClient getCloudSolrClient(String zkHost, SolrInternalHttpClient httpClient) {
     return new CloudSolrClientBuilder(Collections.singletonList(zkHost), Optional.empty())
         .withHttpClient(httpClient)
         .build();
@@ -2346,15 +2523,18 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
     if (shardLeadersOnly) {
       return new CloudSolrClientBuilder(Collections.singletonList(zkHost), Optional.empty())
           .sendUpdatesOnlyToShardLeaders()
+          .withHttpClient(getHttpClient())
           .build();
     }
     return new CloudSolrClientBuilder(Collections.singletonList(zkHost), Optional.empty())
         .sendUpdatesToAllReplicasInShard()
+        .withHttpClient(getHttpClient())
         .build();
   }
 
   public static CloudSolrClientBuilder newCloudSolrClient(String zkHost) {
-    return (CloudSolrClientBuilder) new CloudSolrClientBuilder(Collections.singletonList(zkHost), Optional.empty());
+    return (CloudSolrClientBuilder) new CloudSolrClientBuilder(Collections.singletonList(zkHost), Optional.empty())
+        .withHttpClient(getHttpClient());
   }
 
   /**
@@ -2367,11 +2547,13 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
       return new CloudSolrClientBuilder(Collections.singletonList(zkHost), Optional.empty())
           .sendUpdatesOnlyToShardLeaders()
           .withSocketTimeout(socketTimeoutMillis)
+          .withHttpClient(getHttpClient())
           .build();
     }
     return new CloudSolrClientBuilder(Collections.singletonList(zkHost), Optional.empty())
         .sendUpdatesToAllReplicasInShard()
         .withSocketTimeout(socketTimeoutMillis)
+        .withHttpClient(getHttpClient())
         .build();
   }
   
@@ -2386,12 +2568,14 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
           .sendUpdatesOnlyToShardLeaders()
           .withConnectionTimeout(connectionTimeoutMillis)
           .withSocketTimeout(socketTimeoutMillis)
+          .withHttpClient(getHttpClient())
           .build();
     }
     return new CloudSolrClientBuilder(Collections.singletonList(zkHost), Optional.empty())
         .sendUpdatesToAllReplicasInShard()
         .withConnectionTimeout(connectionTimeoutMillis)
         .withSocketTimeout(socketTimeoutMillis)
+        .withHttpClient(getHttpClient())
         .build();
   }
   
@@ -2402,16 +2586,18 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
    * Tests that do not wish to have any randomized behavior should use the 
    * {@link org.apache.solr.client.solrj.impl.CloudSolrClient.Builder} class directly
    */ 
-  public static CloudSolrClient getCloudSolrClient(String zkHost, boolean shardLeadersOnly, HttpClient httpClient) {
+  public static CloudSolrClient getCloudSolrClient(String zkHost, boolean shardLeadersOnly, SolrInternalHttpClient httpClient) {
     if (shardLeadersOnly) {
       return new CloudSolrClientBuilder(Collections.singletonList(zkHost), Optional.empty())
           .withHttpClient(httpClient)
           .sendUpdatesOnlyToShardLeaders()
+          .withHttpClient(httpClient)
           .build();
     }
     return new CloudSolrClientBuilder(Collections.singletonList(zkHost), Optional.empty())
         .withHttpClient(httpClient)
         .sendUpdatesToAllReplicasInShard()
+        .withHttpClient(httpClient)
         .build();
   }
   
@@ -2420,7 +2606,7 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
    * Tests that do not wish to have any randomized behavior should use the 
    * {@link org.apache.solr.client.solrj.impl.CloudSolrClient.Builder} class directly
    */ 
-  public static CloudSolrClient getCloudSolrClient(String zkHost, boolean shardLeadersOnly, HttpClient httpClient,
+  public static CloudSolrClient getCloudSolrClient(String zkHost, boolean shardLeadersOnly, SolrInternalHttpClient httpClient,
       int connectionTimeoutMillis, int socketTimeoutMillis) {
     if (shardLeadersOnly) {
       return new CloudSolrClientBuilder(Collections.singletonList(zkHost), Optional.empty())
@@ -2428,6 +2614,7 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
           .sendUpdatesOnlyToShardLeaders()
           .withConnectionTimeout(connectionTimeoutMillis)
           .withSocketTimeout(socketTimeoutMillis)
+          .withHttpClient(httpClient)
           .build();
     }
     return new CloudSolrClientBuilder(Collections.singletonList(zkHost), Optional.empty())
@@ -2435,6 +2622,7 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
         .sendUpdatesToAllReplicasInShard()
         .withConnectionTimeout(connectionTimeoutMillis)
         .withSocketTimeout(socketTimeoutMillis)
+        .withHttpClient(httpClient)
         .build();
   }
   
@@ -2445,6 +2633,7 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
    */ 
   public static ConcurrentUpdateSolrClient getConcurrentUpdateSolrClient(String baseSolrUrl, int queueSize, int threadCount) {
     return new ConcurrentUpdateSolrClient.Builder(baseSolrUrl)
+        .withHttpClient(getHttpClient())
         .withQueueSize(queueSize)
         .withThreadCount(threadCount)
         .build();
@@ -2457,6 +2646,7 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
    */ 
   public static ConcurrentUpdateSolrClient getConcurrentUpdateSolrClient(String baseSolrUrl, int queueSize, int threadCount, int connectionTimeoutMillis) {
     return new ConcurrentUpdateSolrClient.Builder(baseSolrUrl)
+        .withHttpClient(getHttpClient())
         .withQueueSize(queueSize)
         .withThreadCount(threadCount)
         .withConnectionTimeout(connectionTimeoutMillis)
@@ -2468,7 +2658,7 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
    * Tests that do not wish to have any randomized behavior should use the 
    * {@link org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrClient.Builder} class directly
    */ 
-  public static ConcurrentUpdateSolrClient getConcurrentUpdateSolrClient(String baseSolrUrl, HttpClient httpClient, int queueSize, int threadCount) {
+  public static ConcurrentUpdateSolrClient getConcurrentUpdateSolrClient(String baseSolrUrl, SolrInternalHttpClient httpClient, int queueSize, int threadCount) {
     return new ConcurrentUpdateSolrClient.Builder(baseSolrUrl)
         .withHttpClient(httpClient)
         .withQueueSize(queueSize)
@@ -2481,10 +2671,11 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
    * Tests that do not wish to have any randomized behavior should use the 
    * {@link org.apache.solr.client.solrj.impl.LBHttpSolrClient.Builder} class directly
    */ 
-  public static LBHttpSolrClient getLBHttpSolrClient(HttpClient client, String... solrUrls) {
+  public static LBHttpSolrClient getLBHttpSolrClient(SolrInternalHttpClient client, String... solrUrls) {
     return new LBHttpSolrClient.Builder()
         .withHttpClient(client)
         .withBaseSolrUrls(solrUrls)
+        .withHttpClient(getHttpClient())
         .build();
   }
   
@@ -2493,13 +2684,14 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
    * Tests that do not wish to have any randomized behavior should use the 
    * {@link org.apache.solr.client.solrj.impl.LBHttpSolrClient.Builder} class directly
    */ 
-  public static LBHttpSolrClient getLBHttpSolrClient(HttpClient client, int connectionTimeoutMillis,
+  public static LBHttpSolrClient getLBHttpSolrClient(SolrInternalHttpClient client, int connectionTimeoutMillis,
       int socketTimeoutMillis, String... solrUrls) {
     return new LBHttpSolrClient.Builder()
         .withHttpClient(client)
         .withBaseSolrUrls(solrUrls)
         .withConnectionTimeout(connectionTimeoutMillis)
         .withSocketTimeout(socketTimeoutMillis)
+        .withHttpClient(getHttpClient())
         .build();
   }
   
@@ -2511,28 +2703,31 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
   public static LBHttpSolrClient getLBHttpSolrClient(String... solrUrls) throws MalformedURLException {
     return new LBHttpSolrClient.Builder()
         .withBaseSolrUrls(solrUrls)
+        .withHttpClient(getHttpClient())
         .build();
   }
   
   /**
    * This method <i>may</i> randomize unspecified aspects of the resulting SolrClient.
    * Tests that do not wish to have any randomized behavior should use the 
-   * {@link org.apache.solr.client.solrj.impl.HttpSolrClient.Builder} class directly
+   * {@link org.apache.solr.client.solrj.impl.Http2SolrClient.Builder} class directly
    */ 
-  public static HttpSolrClient getHttpSolrClient(String url, HttpClient httpClient, ResponseParser responseParser, boolean compression) {
-    return new Builder(url)
+  public static Http2SolrClient getHttpSolrClient(String url, SolrInternalHttpClient httpClient, ResponseParser responseParser, boolean compression) {
+    return new Http2SolrClient.Builder(url)
         .withHttpClient(httpClient)
         .withResponseParser(responseParser)
-        .allowCompression(compression)
-        .build();
+        // nocommit
+        //.allowCompression(compression)
+        .withHttpClient(httpClient)
+      .build();
   }
   
   /**
    * This method <i>may</i> randomize unspecified aspects of the resulting SolrClient.
    * Tests that do not wish to have any randomized behavior should use the 
-   * {@link org.apache.solr.client.solrj.impl.HttpSolrClient.Builder} class directly
+   * {@link org.apache.solr.client.solrj.impl.Http2SolrClient.Builder} class directly
    */ 
-  public static HttpSolrClient getHttpSolrClient(String url, HttpClient httpClient, ResponseParser responseParser) {
+  public static Http2SolrClient getHttpSolrClient(String url, SolrInternalHttpClient httpClient, ResponseParser responseParser) {
     return new Builder(url)
         .withHttpClient(httpClient)
         .withResponseParser(responseParser)
@@ -2542,56 +2737,55 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
   /**
    * This method <i>may</i> randomize unspecified aspects of the resulting SolrClient.
    * Tests that do not wish to have any randomized behavior should use the 
-   * {@link org.apache.solr.client.solrj.impl.HttpSolrClient.Builder} class directly
+   * {@link org.apache.solr.client.solrj.impl.Http2SolrClient.Builder} class directly
    */ 
-  public static HttpSolrClient getHttpSolrClient(String url, HttpClient httpClient) {
-    return new Builder(url)
-        .withHttpClient(httpClient)
+  public static Http2SolrClient getHttpSolrClient(String url, SolrInternalHttpClient httpClient) {
+    return new Http2SolrClient.Builder(url).withHttpClient(httpClient)
         .build();
   }
   
   /**
    * This method <i>may</i> randomize unspecified aspects of the resulting SolrClient.
    * Tests that do not wish to have any randomized behavior should use the 
-   * {@link org.apache.solr.client.solrj.impl.HttpSolrClient.Builder} class directly
+   * {@link org.apache.solr.client.solrj.impl.Http2SolrClient.Builder} class directly
    */ 
-  public static HttpSolrClient getHttpSolrClient(String url, HttpClient httpClient, int connectionTimeoutMillis) {
-    return new Builder(url)
-        .withHttpClient(httpClient)
-        .withConnectionTimeout(connectionTimeoutMillis)
+  public static Http2SolrClient getHttpSolrClient(String url, SolrInternalHttpClient httpClient, int connectionTimeoutMillis) {
+    return new Http2SolrClient.Builder(url).withHttpClient(httpClient)
         .build();
   }
 
   /**
    * This method <i>may</i> randomize unspecified aspects of the resulting SolrClient.
    * Tests that do not wish to have any randomized behavior should use the 
-   * {@link org.apache.solr.client.solrj.impl.HttpSolrClient.Builder} class directly
+   * {@link org.apache.solr.client.solrj.impl.Http2SolrClient.Builder} class directly
    */ 
-  public static HttpSolrClient getHttpSolrClient(String url) {
-    return new Builder(url)
+  public static Http2SolrClient getHttpSolrClient(String url) {
+    return new Http2SolrClient.Builder(url).withHttpClient(getHttpClient())
         .build();
   }
   
   /**
    * This method <i>may</i> randomize unspecified aspects of the resulting SolrClient.
    * Tests that do not wish to have any randomized behavior should use the 
-   * {@link org.apache.solr.client.solrj.impl.HttpSolrClient.Builder} class directly
+   * {@link org.apache.solr.client.solrj.impl.Http2SolrClient.Builder} class directly
    */ 
-  public static HttpSolrClient getHttpSolrClient(String url, int connectionTimeoutMillis) {
+  public static Http2SolrClient getHttpSolrClient(String url, int connectionTimeoutMillis) {
     return new Builder(url)
-        .withConnectionTimeout(connectionTimeoutMillis)
+        .withHttpClient(getHttpClient())
+        //.withConnectionTimeout(connectionTimeoutMillis)
         .build();
   }
   
   /**
    * This method <i>may</i> randomize unspecified aspects of the resulting SolrClient.
    * Tests that do not wish to have any randomized behavior should use the 
-   * {@link org.apache.solr.client.solrj.impl.HttpSolrClient.Builder} class directly
+   * {@link org.apache.solr.client.solrj.impl.Http2SolrClient.Builder} class directly
    */ 
-  public static HttpSolrClient getHttpSolrClient(String url, int connectionTimeoutMillis, int socketTimeoutMillis) {
-    return new Builder(url)
-        .withConnectionTimeout(connectionTimeoutMillis)
-        .withSocketTimeout(socketTimeoutMillis)
+  public static Http2SolrClient getHttpSolrClient(String url, int connectionTimeoutMillis, int socketTimeoutMillis) {
+    return new Http2SolrClient.Builder(url)
+       // .withConnectionTimeout(connectionTimeoutMillis)
+       // .withSocketTimeout(socketTimeoutMillis)
+        .withHttpClient(getHttpClient())
         .build();
   }
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/74a9b54c/solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.java
----------------------------------------------------------------------
diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.java b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.java
index 5f0e596..fc85c24 100644
--- a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.java
+++ b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.java
@@ -16,9 +16,14 @@
  */
 package org.apache.solr.cloud;
 
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
+import static java.util.concurrent.TimeUnit.SECONDS;
+
 import java.io.File;
 import java.lang.invoke.MethodHandles;
 import java.util.Map;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.commons.io.FileUtils;
@@ -40,9 +45,6 @@ import org.junit.BeforeClass;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import static java.util.concurrent.TimeUnit.MILLISECONDS;
-import static java.util.concurrent.TimeUnit.SECONDS;
-
 public abstract class AbstractDistribZkTestBase extends BaseDistributedSearchTestCase {
   
   private static final String REMOVE_VERSION_FIELD = "remove.version.field";
@@ -141,57 +143,55 @@ public abstract class AbstractDistribZkTestBase extends BaseDistributedSearchTes
   }
   
   public static void waitForRecoveriesToFinish(String collection,
-      ZkStateReader zkStateReader, boolean verbose, boolean failOnTimeout, int timeoutSeconds)
+      ZkStateReader zkStateReader, boolean verbose, boolean failOnTimeout, long timeoutSeconds)
       throws Exception {
     log.info("Wait for recoveries to finish - collection: " + collection + " failOnTimeout:" + failOnTimeout + " timeout (sec):" + timeoutSeconds);
-    boolean cont = true;
-    int cnt = 0;
-    
-    while (cont) {
-      if (verbose) System.out.println("-");
-      boolean sawLiveRecovering = false;
-      ClusterState clusterState = zkStateReader.getClusterState();
-      final DocCollection docCollection = clusterState.getCollectionOrNull(collection);
-      assertNotNull("Could not find collection:" + collection, docCollection);
-      Map<String,Slice> slices = docCollection.getSlicesMap();
-      assertNotNull("Could not find collection:" + collection, slices);
-      for (Map.Entry<String,Slice> entry : slices.entrySet()) {
-        Slice slice = entry.getValue();
-        if (slice.getState() == Slice.State.CONSTRUCTION) { // similar to replica recovering; pretend its the same thing
-          if (verbose) System.out.println("Found a slice in construction state; will wait.");
-          sawLiveRecovering = true;
-        }
-        Map<String,Replica> shards = slice.getReplicasMap();
-        for (Map.Entry<String,Replica> shard : shards.entrySet()) {
-          if (verbose) System.out.println("replica:" + shard.getValue().getName() + " rstate:"
-              + shard.getValue().getStr(ZkStateReader.STATE_PROP)
-              + " live:"
-              + clusterState.liveNodesContain(shard.getValue().getNodeName()));
-          final Replica.State state = shard.getValue().getState();
-          if ((state == Replica.State.RECOVERING || state == Replica.State.DOWN || state == Replica.State.RECOVERY_FAILED)
-              && clusterState.liveNodesContain(shard.getValue().getStr(ZkStateReader.NODE_NAME_PROP))) {
+    try {
+      zkStateReader.waitForState(collection, timeoutSeconds, TimeUnit.SECONDS, (liveNodes, docCollection) -> {
+        if (docCollection == null)
+          return false;
+        boolean sawLiveRecovering = false;
+
+        assertNotNull("Could not find collection:" + collection, docCollection);
+        Map<String,Slice> slices = docCollection.getSlicesMap();
+        assertNotNull("Could not find collection:" + collection, slices);
+        for (Map.Entry<String,Slice> entry : slices.entrySet()) {
+          Slice slice = entry.getValue();
+          if (slice.getState() == Slice.State.CONSTRUCTION) { // similar to replica recovering; pretend its the same
+                                                              // thing
+            if (verbose) System.out.println("Found a slice in construction state; will wait.");
             sawLiveRecovering = true;
           }
+          Map<String,Replica> shards = slice.getReplicasMap();
+          for (Map.Entry<String,Replica> shard : shards.entrySet()) {
+            if (verbose) System.out.println("replica:" + shard.getValue().getName() + " rstate:"
+                + shard.getValue().getStr(ZkStateReader.STATE_PROP)
+                + " live:"
+                + liveNodes.contains(shard.getValue().getNodeName()));
+            final Replica.State state = shard.getValue().getState();
+            if ((state == Replica.State.RECOVERING || state == Replica.State.DOWN
+                || state == Replica.State.RECOVERY_FAILED)
+                && liveNodes.contains(shard.getValue().getStr(ZkStateReader.NODE_NAME_PROP))) {
+              return false;
+            }
+          }
         }
-      }
-      if (!sawLiveRecovering || cnt == timeoutSeconds) {
         if (!sawLiveRecovering) {
-          if (verbose) System.out.println("no one is recoverying");
-        } else {
-          if (verbose) System.out.println("Gave up waiting for recovery to finish..");
-          if (failOnTimeout) {
-            Diagnostics.logThreadDumps("Gave up waiting for recovery to finish.  THREAD DUMP:");
-            zkStateReader.getZkClient().printLayoutToStdOut();
-            fail("There are still nodes recoverying - waited for " + timeoutSeconds + " seconds");
-            // won't get here
-            return;
+          if (!sawLiveRecovering) {
+            if (verbose) System.out.println("no one is recoverying");
+          } else {
+            if (verbose) System.out.println("Gave up waiting for recovery to finish..");
+            return false;
           }
+          return true;
+        } else {
+          return false;
         }
-        cont = false;
-      } else {
-        Thread.sleep(1000);
-      }
-      cnt++;
+      });
+    } catch (TimeoutException | InterruptedException e) {
+      Diagnostics.logThreadDumps("Gave up waiting for recovery to finish.  THREAD DUMP:");
+      zkStateReader.getZkClient().printLayoutToStdOut();
+      fail("There are still nodes recoverying - waited for " + timeoutSeconds + " seconds");
     }
 
     log.info("Recoveries finished - collection: " + collection);


Mime
View raw message