You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ro...@apache.org on 2014/12/31 15:31:05 UTC

svn commit: r1648706 [6/9] - in /lucene/dev/branches/branch_5x/solr: ./ contrib/ contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/ contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/ contrib/map-reduce/src/java/o...

Modified: lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/schema/TestCloudSchemaless.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/schema/TestCloudSchemaless.java?rev=1648706&r1=1648705&r2=1648706&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/schema/TestCloudSchemaless.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/schema/TestCloudSchemaless.java Wed Dec 31 14:31:03 2014
@@ -17,8 +17,8 @@ package org.apache.solr.schema;
  */
 
 import org.apache.solr.SolrTestCaseJ4.SuppressSSL;
-import org.apache.solr.client.solrj.SolrServer;
-import org.apache.solr.client.solrj.impl.HttpSolrServer;
+import org.apache.solr.client.solrj.SolrClient;
+import org.apache.solr.client.solrj.impl.HttpSolrClient;
 import org.apache.solr.cloud.AbstractFullDistribZkTestBase;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.SolrException.ErrorCode;
@@ -90,11 +90,11 @@ public class TestCloudSchemaless extends
   private List<RestTestHarness> restTestHarnesses = new ArrayList<>();
 
   private void setupHarnesses() {
-    for (final SolrServer client : clients) {
+    for (final SolrClient client : clients) {
       RestTestHarness harness = new RestTestHarness(new RESTfulServerProvider() {
         @Override
         public String getBaseURL() {
-          return ((HttpSolrServer)client).getBaseURL();
+          return ((HttpSolrClient)client).getBaseURL();
         }
       });
       restTestHarnesses.add(harness);
@@ -120,12 +120,12 @@ public class TestCloudSchemaless extends
     // First, add a bunch of documents in a single update with the same new field.
     // This tests that the replicas properly handle schema additions.
 
-    int slices =  getCommonCloudSolrServer().getZkStateReader().getClusterState()
+    int slices =  getCommonCloudSolrClient().getZkStateReader().getClusterState()
       .getActiveSlices("collection1").size();
     int trials = 50;
     // generate enough docs so that we can expect at least a doc per slice
     int numDocsPerTrial = (int)(slices * (Math.log(slices) + 1));
-    SolrServer ss = clients.get(random().nextInt(clients.size()));
+    SolrClient randomClient = clients.get(random().nextInt(clients.size()));
     int docNumber = 0;
     for (int i = 0; i < trials; ++i) {
       List<SolrInputDocument> docs = new ArrayList<>();
@@ -137,9 +137,9 @@ public class TestCloudSchemaless extends
         docs.add(doc);
       }
 
-      ss.add(docs);
+      randomClient.add(docs);
     }
-    ss.commit();
+    randomClient.commit();
 
     String [] expectedFields = getExpectedFieldResponses(docNumber);
     // Check that all the fields were added
@@ -175,8 +175,8 @@ public class TestCloudSchemaless extends
       }
 
       try {
-        ss.add(docs);
-        ss.commit();
+        randomClient.add(docs);
+        randomClient.commit();
         fail("Expected Bad Request Exception");
       } catch (SolrException se) {
         assertEquals(ErrorCode.BAD_REQUEST, ErrorCode.getErrorCode(se.code()));

Modified: lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/search/TestSolrJ.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/search/TestSolrJ.java?rev=1648706&r1=1648705&r2=1648706&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/search/TestSolrJ.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/search/TestSolrJ.java Wed Dec 31 14:31:03 2014
@@ -19,10 +19,10 @@ package org.apache.solr.search;
 
 
 import org.apache.solr.SolrTestCaseJ4;
-import org.apache.solr.client.solrj.SolrServer;
+import org.apache.solr.client.solrj.SolrClient;
 import org.apache.solr.client.solrj.SolrServerException;
-import org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrServer;
-import org.apache.solr.client.solrj.impl.HttpSolrServer;
+import org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrClient;
+import org.apache.solr.client.solrj.impl.HttpSolrClient;
 import org.apache.solr.common.SolrInputDocument;
 
 import java.io.IOException;
@@ -41,7 +41,7 @@ public class TestSolrJ extends SolrTestC
     // doCommitPerf();
   }
 
-  public static SolrServer server;
+  public static SolrClient client;
   public static String idField = "id";
   public static Exception ex;
 
@@ -56,13 +56,13 @@ public class TestSolrJ extends SolrTestC
     final int nConnections = Integer.parseInt(args[i++]);
     final int maxSleep = Integer.parseInt(args[i++]);
 
-    ConcurrentUpdateSolrServer sserver = null;
+    ConcurrentUpdateSolrClient concurrentClient = null;
 
-    // server = sserver = new ConcurrentUpdateSolrServer(addr,32,8);
-    server = sserver = new ConcurrentUpdateSolrServer(addr,64,nConnections);
+    // server = concurrentClient = new ConcurrentUpdateSolrServer(addr,32,8);
+    client = concurrentClient = new ConcurrentUpdateSolrClient(addr,64,nConnections);
 
-    server.deleteByQuery("*:*");
-    server.commit();
+    client.deleteByQuery("*:*");
+    client.commit();
 
     long start = System.currentTimeMillis();
 
@@ -94,8 +94,8 @@ public class TestSolrJ extends SolrTestC
       threads[threadNum].join();
     }
 
-    if (sserver != null) {
-      sserver.blockUntilFinished();
+    if (concurrentClient != null) {
+      concurrentClient.blockUntilFinished();
     }
 
     long end = System.currentTimeMillis();
@@ -145,7 +145,7 @@ public class TestSolrJ extends SolrTestC
       }
 
       SolrInputDocument doc = getDocument(i);
-      server.add(doc);
+      client.add(doc);
 
       if (maxSleep > 0) {
         int sleep = r.nextInt(maxSleep);
@@ -163,7 +163,7 @@ public class TestSolrJ extends SolrTestC
 
 
   public void doCommitPerf() throws Exception {
-    HttpSolrServer client = new HttpSolrServer("http://127.0.0.1:8983/solr");
+    HttpSolrClient client = new HttpSolrClient("http://127.0.0.1:8983/solr");
 
     long start = System.currentTimeMillis();
 

Modified: lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/search/stats/TestDefaultStatsCache.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/search/stats/TestDefaultStatsCache.java?rev=1648706&r1=1648705&r2=1648706&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/search/stats/TestDefaultStatsCache.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/search/stats/TestDefaultStatsCache.java Wed Dec 31 14:31:03 2014
@@ -18,7 +18,7 @@ package org.apache.solr.search.stats;
  */
 
 import org.apache.solr.BaseDistributedSearchTestCase;
-import org.apache.solr.client.solrj.SolrServer;
+import org.apache.solr.client.solrj.SolrClient;
 import org.apache.solr.client.solrj.response.QueryResponse;
 import org.apache.solr.common.SolrDocumentList;
 import org.apache.solr.common.params.ModifiableSolrParams;
@@ -97,7 +97,7 @@ public class TestDefaultStatsCache exten
     // query a random server
     params.set("shards", shards);
     int which = r.nextInt(clients.size());
-    SolrServer client = clients.get(which);
+    SolrClient client = clients.get(which);
     QueryResponse rsp = client.query(params);
     checkResponse(controlRsp, rsp);
   }

Modified: lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/servlet/CacheHeaderTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/servlet/CacheHeaderTestBase.java?rev=1648706&r1=1648705&r2=1648706&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/servlet/CacheHeaderTestBase.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/servlet/CacheHeaderTestBase.java Wed Dec 31 14:31:03 2014
@@ -16,11 +16,6 @@
  */
 package org.apache.solr.servlet;
 
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.nio.charset.StandardCharsets;
-import java.util.ArrayList;
-
 import org.apache.http.HttpResponse;
 import org.apache.http.client.HttpClient;
 import org.apache.http.client.methods.HttpGet;
@@ -31,13 +26,18 @@ import org.apache.http.client.utils.URLE
 import org.apache.http.message.BasicNameValuePair;
 import org.apache.http.util.EntityUtils;
 import org.apache.solr.SolrJettyTestBase;
-import org.apache.solr.client.solrj.impl.HttpSolrServer;
+import org.apache.solr.client.solrj.impl.HttpSolrClient;
 import org.junit.Test;
 
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+
 public abstract class CacheHeaderTestBase extends SolrJettyTestBase {
 
   protected HttpRequestBase getSelectMethod(String method, String... params) throws URISyntaxException {
-    HttpSolrServer httpserver = (HttpSolrServer)getSolrServer();
+    HttpSolrClient client = (HttpSolrClient) getSolrClient();
     HttpRequestBase m = null;
     
     ArrayList<BasicNameValuePair> qparams = new ArrayList<>();
@@ -49,7 +49,7 @@ public abstract class CacheHeaderTestBas
       qparams.add(new BasicNameValuePair(params[i * 2], params[i * 2 + 1]));
     }
 
-    URI uri = URI.create(httpserver.getBaseURL() + "/select?" +
+    URI uri = URI.create(client.getBaseURL() + "/select?" +
                          URLEncodedUtils.format(qparams, StandardCharsets.UTF_8));
    
     if ("GET".equals(method)) {
@@ -64,7 +64,7 @@ public abstract class CacheHeaderTestBas
   }
 
   protected HttpRequestBase getUpdateMethod(String method, String... params) throws URISyntaxException {
-    HttpSolrServer httpserver = (HttpSolrServer)getSolrServer();
+    HttpSolrClient client = (HttpSolrClient) getSolrClient();
     HttpRequestBase m = null;
     
     ArrayList<BasicNameValuePair> qparams = new ArrayList<>();
@@ -72,7 +72,7 @@ public abstract class CacheHeaderTestBas
       qparams.add(new BasicNameValuePair(params[i*2], params[i*2+1]));
     }
 
-    URI uri = URI.create(httpserver.getBaseURL() + "/update?" + 
+    URI uri = URI.create(client.getBaseURL() + "/update?" +
                          URLEncodedUtils.format(qparams, StandardCharsets.UTF_8));
     
     if ("GET".equals(method)) {
@@ -87,8 +87,8 @@ public abstract class CacheHeaderTestBas
   }
   
   protected HttpClient getClient() {
-    HttpSolrServer httpserver = (HttpSolrServer)getSolrServer();
-    return httpserver.getHttpClient();
+    HttpSolrClient client = (HttpSolrClient) getSolrClient();
+    return client.getHttpClient();
   }
 
   protected void checkResponseBody(String method, HttpResponse resp)

Modified: lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/servlet/ResponseHeaderTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/servlet/ResponseHeaderTest.java?rev=1648706&r1=1648705&r2=1648706&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/servlet/ResponseHeaderTest.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/servlet/ResponseHeaderTest.java Wed Dec 31 14:31:03 2014
@@ -32,7 +32,7 @@ import org.apache.http.client.methods.Ht
 import org.apache.solr.SolrJettyTestBase;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.client.solrj.SolrServerException;
-import org.apache.solr.client.solrj.impl.HttpSolrServer;
+import org.apache.solr.client.solrj.impl.HttpSolrClient;
 import org.apache.solr.handler.component.ResponseBuilder;
 import org.apache.solr.handler.component.SearchComponent;
 import org.apache.solr.response.SolrQueryResponse;
@@ -61,7 +61,7 @@ public class ResponseHeaderTest extends
   
   @Test
   public void testHttpResponse() throws SolrServerException, IOException {
-    HttpSolrServer client = (HttpSolrServer)getSolrServer();
+    HttpSolrClient client = (HttpSolrClient) getSolrClient();
     HttpClient httpClient = client.getHttpClient();
     URI uri = URI.create(client.getBaseURL() + "/withHeaders?q=*:*");
     HttpGet httpGet = new HttpGet(uri);

Modified: lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/update/PeerSyncTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/update/PeerSyncTest.java?rev=1648706&r1=1648705&r2=1648706&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/update/PeerSyncTest.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/update/PeerSyncTest.java Wed Dec 31 14:31:03 2014
@@ -17,20 +17,20 @@ package org.apache.solr.update;
  * limitations under the License.
  */
 
-import java.io.IOException;
-import java.util.Arrays;
-
 import org.apache.solr.BaseDistributedSearchTestCase;
 import org.apache.solr.SolrTestCaseJ4.SuppressSSL;
-import org.apache.solr.client.solrj.SolrServer;
+import org.apache.solr.client.solrj.SolrClient;
 import org.apache.solr.client.solrj.SolrServerException;
 import org.apache.solr.client.solrj.request.QueryRequest;
 import org.apache.solr.common.params.ModifiableSolrParams;
 import org.apache.solr.common.util.NamedList;
 import org.apache.solr.common.util.StrUtils;
 
-import static org.apache.solr.update.processor.DistributingUpdateProcessorFactory.DISTRIB_UPDATE_PARAM;
+import java.io.IOException;
+import java.util.Arrays;
+
 import static org.apache.solr.update.processor.DistributedUpdateProcessor.DistribPhase;
+import static org.apache.solr.update.processor.DistributingUpdateProcessorFactory.DISTRIB_UPDATE_PARAM;
 
 @SuppressSSL(bugUrl = "https://issues.apache.org/jira/browse/SOLR-5776")
 public class PeerSyncTest extends BaseDistributedSearchTestCase {
@@ -58,9 +58,9 @@ public class PeerSyncTest extends BaseDi
     handle.put("score", SKIPVAL);
     handle.put("maxScore", SKIPVAL);
 
-    SolrServer client0 = clients.get(0);
-    SolrServer client1 = clients.get(1);
-    SolrServer client2 = clients.get(2);
+    SolrClient client0 = clients.get(0);
+    SolrClient client1 = clients.get(1);
+    SolrClient client2 = clients.get(2);
 
     long v = 0;
     add(client0, seenLeader, sdoc("id","1","_version_",++v));
@@ -128,7 +128,7 @@ public class PeerSyncTest extends BaseDi
 
     // test that delete by query is returned even if not requested, and that it doesn't delete newer stuff than it should
     v=2000;
-    SolrServer client = client0;
+    SolrClient client = client0;
     add(client, seenLeader, sdoc("id","2000","_version_",++v));
     add(client, seenLeader, sdoc("id","2001","_version_",++v));
     delQ(client, params(DISTRIB_UPDATE_PARAM,FROM_LEADER,"_version_",Long.toString(-++v)), "id:2001 OR id:2002");
@@ -173,9 +173,9 @@ public class PeerSyncTest extends BaseDi
   }
 
 
-  void assertSync(SolrServer server, int numVersions, boolean expectedResult, String... syncWith) throws IOException, SolrServerException {
+  void assertSync(SolrClient client, int numVersions, boolean expectedResult, String... syncWith) throws IOException, SolrServerException {
     QueryRequest qr = new QueryRequest(params("qt","/get", "getVersions",Integer.toString(numVersions), "sync", StrUtils.join(Arrays.asList(syncWith), ',')));
-    NamedList rsp = server.request(qr);
+    NamedList rsp = client.request(qr);
     assertEquals(expectedResult, (Boolean) rsp.get("sync"));
   }
 

Modified: lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/update/SolrCmdDistributorTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/update/SolrCmdDistributorTest.java?rev=1648706&r1=1648705&r2=1648706&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/update/SolrCmdDistributorTest.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/update/SolrCmdDistributorTest.java Wed Dec 31 14:31:03 2014
@@ -20,10 +20,10 @@ package org.apache.solr.update;
 import org.apache.lucene.index.LogDocMergePolicy;
 import org.apache.solr.BaseDistributedSearchTestCase;
 import org.apache.solr.client.solrj.SolrQuery;
-import org.apache.solr.client.solrj.SolrServer;
+import org.apache.solr.client.solrj.SolrClient;
 import org.apache.solr.client.solrj.SolrServerException;
 import org.apache.solr.client.solrj.embedded.JettySolrRunner;
-import org.apache.solr.client.solrj.impl.HttpSolrServer;
+import org.apache.solr.client.solrj.impl.HttpSolrClient;
 import org.apache.solr.client.solrj.request.LukeRequest;
 import org.apache.solr.client.solrj.request.UpdateRequest;
 import org.apache.solr.common.SolrDocumentList;
@@ -40,7 +40,7 @@ import org.apache.solr.core.SolrCore;
 import org.apache.solr.core.SolrEventListener;
 import org.apache.solr.search.SolrIndexSearcher;
 import org.apache.solr.servlet.SolrDispatchFilter;
-import org.apache.solr.update.MockStreamingSolrServers.Exp;
+import org.apache.solr.update.MockStreamingSolrClients.Exp;
 import org.apache.solr.update.SolrCmdDistributor.Error;
 import org.apache.solr.update.SolrCmdDistributor.Node;
 import org.apache.solr.update.SolrCmdDistributor.RetryNode;
@@ -107,7 +107,7 @@ public class SolrCmdDistributorTest exte
   protected void createServers(int numShards) throws Exception {
     controlJetty = createJetty(new File(getSolrHome()), testDir + "/control/data", null, getSolrConfigFile(), getSchemaFile());
 
-    controlClient = createNewSolrServer(controlJetty.getLocalPort());
+    controlClient = createNewSolrClient(controlJetty.getLocalPort());
 
     shardsArr = new String[numShards];
     StringBuilder sb = new StringBuilder();
@@ -117,7 +117,7 @@ public class SolrCmdDistributorTest exte
           testDir + "/shard" + i + "/data", null, getSolrConfigFile(),
           getSchemaFile());
       jettys.add(j);
-      clients.add(createNewSolrServer(j.getLocalPort()));
+      clients.add(createNewSolrClient(j.getLocalPort()));
       String shardStr = buildUrl(j.getLocalPort());
       shardsArr[i] = shardStr;
       sb.append(shardStr);
@@ -137,7 +137,7 @@ public class SolrCmdDistributorTest exte
     List<Node> nodes = new ArrayList<>();
 
     ZkNodeProps nodeProps = new ZkNodeProps(ZkStateReader.BASE_URL_PROP,
-        ((HttpSolrServer) controlClient).getBaseURL(),
+        ((HttpSolrClient) controlClient).getBaseURL(),
         ZkStateReader.CORE_NAME_PROP, "");
     nodes.add(new StdNode(new ZkCoreNodeProps(nodeProps)));
 
@@ -164,7 +164,7 @@ public class SolrCmdDistributorTest exte
         .getNumFound();
     assertEquals(1, numFound);
     
-    HttpSolrServer client = (HttpSolrServer) clients.get(0);
+    HttpSolrClient client = (HttpSolrClient) clients.get(0);
     nodeProps = new ZkNodeProps(ZkStateReader.BASE_URL_PROP,
         client.getBaseURL(), ZkStateReader.CORE_NAME_PROP, "");
     nodes.add(new StdNode(new ZkCoreNodeProps(nodeProps)));
@@ -239,7 +239,7 @@ public class SolrCmdDistributorTest exte
         .getNumFound();
     assertEquals(results.toString(), 2, numFound);
     
-    for (SolrServer c : clients) {
+    for (SolrClient c : clients) {
       c.optimize();
       //System.out.println(clients.get(0).request(new LukeRequest()));
     }
@@ -249,11 +249,11 @@ public class SolrCmdDistributorTest exte
     int cnt = atLeast(303);
     for (int i = 0; i < cnt; i++) {
       nodes.clear();
-      for (SolrServer c : clients) {
+      for (SolrClient c : clients) {
         if (random().nextBoolean()) {
           continue;
         }
-        HttpSolrServer httpClient = (HttpSolrServer) c;
+        HttpSolrClient httpClient = (HttpSolrClient) c;
         nodeProps = new ZkNodeProps(ZkStateReader.BASE_URL_PROP,
             httpClient.getBaseURL(), ZkStateReader.CORE_NAME_PROP, "");
         nodes.add(new StdNode(new ZkCoreNodeProps(nodeProps)));
@@ -269,8 +269,8 @@ public class SolrCmdDistributorTest exte
     
     nodes.clear();
     
-    for (SolrServer c : clients) {
-      HttpSolrServer httpClient = (HttpSolrServer) c;
+    for (SolrClient c : clients) {
+      HttpSolrClient httpClient = (HttpSolrClient) c;
       nodeProps = new ZkNodeProps(ZkStateReader.BASE_URL_PROP,
           httpClient.getBaseURL(), ZkStateReader.CORE_NAME_PROP, "");
       
@@ -311,7 +311,7 @@ public class SolrCmdDistributorTest exte
 
     assertEquals(shardCount, commits.get());
     
-    for (SolrServer c : clients) {
+    for (SolrClient c : clients) {
       NamedList<Object> resp = c.request(new LukeRequest());
       assertEquals("SOLR-3428: We only did adds - there should be no deletes",
           ((NamedList<Object>) resp.get("index")).get("numDocs"),
@@ -328,11 +328,11 @@ public class SolrCmdDistributorTest exte
   }
 
   private void testMaxRetries() throws IOException {
-    final MockStreamingSolrServers ss = new MockStreamingSolrServers(updateShardHandler);
-    SolrCmdDistributor cmdDistrib = new SolrCmdDistributor(ss, 5, 0);
-    ss.setExp(Exp.CONNECT_EXCEPTION);
+    final MockStreamingSolrClients streamingClients = new MockStreamingSolrClients(updateShardHandler);
+    SolrCmdDistributor cmdDistrib = new SolrCmdDistributor(streamingClients, 5, 0);
+    streamingClients.setExp(Exp.CONNECT_EXCEPTION);
     ArrayList<Node> nodes = new ArrayList<>();
-    final HttpSolrServer solrclient1 = (HttpSolrServer) clients.get(0);
+    final HttpSolrClient solrclient1 = (HttpSolrClient) clients.get(0);
     
     final AtomicInteger retries = new AtomicInteger();
     ZkNodeProps nodeProps = new ZkNodeProps(ZkStateReader.BASE_URL_PROP, solrclient1.getBaseURL(), ZkStateReader.CORE_NAME_PROP, "");
@@ -359,12 +359,12 @@ public class SolrCmdDistributorTest exte
   }
   
   private void testOneRetry() throws Exception {
-    final HttpSolrServer solrclient = (HttpSolrServer) clients.get(0);
+    final HttpSolrClient solrclient = (HttpSolrClient) clients.get(0);
     long numFoundBefore = solrclient.query(new SolrQuery("*:*")).getResults()
         .getNumFound();
-    final MockStreamingSolrServers ss = new MockStreamingSolrServers(updateShardHandler);
-    SolrCmdDistributor cmdDistrib = new SolrCmdDistributor(ss, 5, 0);
-    ss.setExp(Exp.CONNECT_EXCEPTION);
+    final MockStreamingSolrClients streamingClients = new MockStreamingSolrClients(updateShardHandler);
+    SolrCmdDistributor cmdDistrib = new SolrCmdDistributor(streamingClients, 5, 0);
+    streamingClients.setExp(Exp.CONNECT_EXCEPTION);
     ArrayList<Node> nodes = new ArrayList<>();
 
     ZkNodeProps nodeProps = new ZkNodeProps(ZkStateReader.BASE_URL_PROP, solrclient.getBaseURL(),
@@ -375,7 +375,7 @@ public class SolrCmdDistributorTest exte
     RetryNode retryNode = new RetryNode(new ZkCoreNodeProps(nodeProps), null, "collection1", "shard1") {
       @Override
       public boolean checkRetry() {
-        ss.setExp(null);
+        streamingClients.setExp(null);
         retries.incrementAndGet();
         return true;
       }
@@ -405,12 +405,12 @@ public class SolrCmdDistributorTest exte
   }
 
   private void testRetryNodeWontRetrySocketError() throws Exception {
-    final HttpSolrServer solrclient = (HttpSolrServer) clients.get(0);
+    final HttpSolrClient solrclient = (HttpSolrClient) clients.get(0);
     long numFoundBefore = solrclient.query(new SolrQuery("*:*")).getResults()
         .getNumFound();
-    final MockStreamingSolrServers ss = new MockStreamingSolrServers(updateShardHandler);
-    SolrCmdDistributor cmdDistrib = new SolrCmdDistributor(ss, 5, 0);
-    ss.setExp(Exp.SOCKET_EXCEPTION);
+    final MockStreamingSolrClients streamingClients = new MockStreamingSolrClients(updateShardHandler);
+    SolrCmdDistributor cmdDistrib = new SolrCmdDistributor(streamingClients, 5, 0);
+    streamingClients.setExp(Exp.SOCKET_EXCEPTION);
     ArrayList<Node> nodes = new ArrayList<>();
 
     ZkNodeProps nodeProps = new ZkNodeProps(ZkStateReader.BASE_URL_PROP, solrclient.getBaseURL(),
@@ -436,7 +436,7 @@ public class SolrCmdDistributorTest exte
     CommitUpdateCommand ccmd = new CommitUpdateCommand(null, false);
     cmdDistrib.distribAdd(cmd, nodes, params);
     
-    ss.setExp(null);
+    streamingClients.setExp(null);
     cmdDistrib.distribCommit(ccmd, nodes, params);
     cmdDistrib.finish();
     
@@ -455,7 +455,7 @@ public class SolrCmdDistributorTest exte
   private void testRetryNodeAgainstBadAddress() throws SolrServerException, IOException {
     // Test RetryNode
     SolrCmdDistributor cmdDistrib = new SolrCmdDistributor(updateShardHandler);
-    final HttpSolrServer solrclient = (HttpSolrServer) clients.get(0);
+    final HttpSolrClient solrclient = (HttpSolrClient) clients.get(0);
     long numFoundBefore = solrclient.query(new SolrQuery("*:*")).getResults()
         .getNumFound();
     

Modified: lucene/dev/branches/branch_5x/solr/solrj/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/solrj/build.xml?rev=1648706&r1=1648705&r2=1648706&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/solrj/build.xml (original)
+++ lucene/dev/branches/branch_5x/solr/solrj/build.xml Wed Dec 31 14:31:03 2014
@@ -22,7 +22,7 @@
 
   <!-- violates the servlet-api restrictions, but it is safe to do so in this test: -->
   <property name="forbidden-tests-excludes" value="
-    org/apache/solr/client/solrj/impl/BasicHttpSolrServerTest$DebugServlet.class
+    org/apache/solr/client/solrj/impl/BasicHttpSolrClientTest$DebugServlet.class
   "/>
 
   <import file="../common-build.xml"/>

Modified: lucene/dev/branches/branch_5x/solr/solrj/src/java/org/apache/solr/client/solrj/SolrRequest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/solrj/src/java/org/apache/solr/client/solrj/SolrRequest.java?rev=1648706&r1=1648705&r2=1648706&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/solrj/src/java/org/apache/solr/client/solrj/SolrRequest.java (original)
+++ lucene/dev/branches/branch_5x/solr/solrj/src/java/org/apache/solr/client/solrj/SolrRequest.java Wed Dec 31 14:31:03 2014
@@ -109,5 +109,5 @@ public abstract class SolrRequest implem
 
   public abstract SolrParams getParams();
   public abstract Collection<ContentStream> getContentStreams() throws IOException;
-  public abstract SolrResponse process( SolrServer server ) throws SolrServerException, IOException;
+  public abstract SolrResponse process( SolrClient server ) throws SolrServerException, IOException;
 }

Modified: lucene/dev/branches/branch_5x/solr/solrj/src/java/org/apache/solr/client/solrj/SolrServer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/solrj/src/java/org/apache/solr/client/solrj/SolrServer.java?rev=1648706&r1=1648705&r2=1648706&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/solrj/src/java/org/apache/solr/client/solrj/SolrServer.java (original)
+++ lucene/dev/branches/branch_5x/solr/solrj/src/java/org/apache/solr/client/solrj/SolrServer.java Wed Dec 31 14:31:03 2014
@@ -17,335 +17,9 @@
 
 package org.apache.solr.client.solrj;
 
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.Collection;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.solr.client.solrj.request.QueryRequest;
-import org.apache.solr.client.solrj.request.SolrPing;
-import org.apache.solr.client.solrj.request.UpdateRequest;
-import org.apache.solr.client.solrj.response.QueryResponse;
-import org.apache.solr.client.solrj.response.SolrPingResponse;
-import org.apache.solr.client.solrj.response.UpdateResponse;
-import org.apache.solr.client.solrj.SolrRequest.METHOD;
-import org.apache.solr.client.solrj.beans.DocumentObjectBinder;
-import org.apache.solr.client.solrj.impl.StreamingBinaryResponseParser;
-import org.apache.solr.common.SolrInputDocument;
-import org.apache.solr.common.params.SolrParams;
-import org.apache.solr.common.util.NamedList;
-
 /**
- *
- * @since solr 1.3
+ * @deprecated Use {@link org.apache.solr.client.solrj.SolrClient}
  */
-public abstract class SolrServer implements Serializable
-{
-  private static final long serialVersionUID = 1L;
-  private DocumentObjectBinder binder;
-
-  /**
-   * Adds a collection of documents
-   * @param docs  the collection of documents
-   * @throws IOException If there is a low-level I/O error.
-   */
-  public UpdateResponse add(Collection<SolrInputDocument> docs) throws SolrServerException, IOException {
-    return add(docs, -1);
-  }
-
-  /**
-   * Adds a collection of documents, specifying max time before they become committed
-   * @param docs  the collection of documents
-   * @param commitWithinMs  max time (in ms) before a commit will happen 
-   * @throws IOException If there is a low-level I/O error.
-   * @since solr 3.5
-   */
-  public UpdateResponse add(Collection<SolrInputDocument> docs, int commitWithinMs) throws SolrServerException, IOException {
-    UpdateRequest req = new UpdateRequest();
-    req.add(docs);
-    req.setCommitWithin(commitWithinMs);
-    return req.process(this);
-  }
-
-  /**
-   * Adds a collection of beans
-   * @param beans  the collection of beans
-   * @throws IOException If there is a low-level I/O error.
-   */
-  public UpdateResponse addBeans(Collection<?> beans ) throws SolrServerException, IOException {
-    return addBeans(beans, -1);
-  }
-  
-  /**
-   * Adds a collection of beans specifying max time before they become committed
-   * @param beans  the collection of beans
-   * @param commitWithinMs  max time (in ms) before a commit will happen 
-   * @throws IOException If there is a low-level I/O error.
-   * @since solr 3.5
-   */
-  public UpdateResponse addBeans(Collection<?> beans, int commitWithinMs) throws SolrServerException, IOException {
-    DocumentObjectBinder binder = this.getBinder();
-    ArrayList<SolrInputDocument> docs =  new ArrayList<>(beans.size());
-    for (Object bean : beans) {
-      docs.add(binder.toSolrInputDocument(bean));
-    }
-    return add(docs, commitWithinMs);
-  }
-
-  /**
-   * Adds a single document
-   * @param doc  the input document
-   * @throws IOException If there is a low-level I/O error.
-   */
-  public UpdateResponse add(SolrInputDocument doc ) throws SolrServerException, IOException {
-    return add(doc, -1);
-  }
-
-  /**
-   * Adds a single document specifying max time before it becomes committed
-   * @param doc  the input document
-   * @param commitWithinMs  max time (in ms) before a commit will happen 
-   * @throws IOException If there is a low-level I/O error.
-   * @since solr 3.5
-   */
-  public UpdateResponse add(SolrInputDocument doc, int commitWithinMs) throws SolrServerException, IOException {
-    UpdateRequest req = new UpdateRequest();
-    req.add(doc);
-    req.setCommitWithin(commitWithinMs);
-    return req.process(this);
-  }
-
-  /**
-   * Adds a single bean
-   * @param obj  the input bean
-   * @throws IOException If there is a low-level I/O error.
-   */
-  public UpdateResponse addBean(Object obj) throws IOException, SolrServerException {
-    return addBean(obj, -1);
-  }
-
-  /**
-   * Adds a single bean specifying max time before it becomes committed
-   * @param obj  the input bean
-   * @param commitWithinMs  max time (in ms) before a commit will happen 
-   * @throws IOException If there is a low-level I/O error.
-   * @since solr 3.5
-   */
-  public UpdateResponse addBean(Object obj, int commitWithinMs) throws IOException, SolrServerException {
-    return add(getBinder().toSolrInputDocument(obj),commitWithinMs);
-  }
-
-  /** 
-   * Performs an explicit commit, causing pending documents to be committed for indexing
-   * <p>
-   * waitFlush=true and waitSearcher=true to be inline with the defaults for plain HTTP access
-   * @throws IOException If there is a low-level I/O error.
-   */
-  public UpdateResponse commit( ) throws SolrServerException, IOException {
-    return commit(true, true);
-  }
-
-  /** 
-   * Performs an explicit optimize, causing a merge of all segments to one.
-   * <p>
-   * waitFlush=true and waitSearcher=true to be inline with the defaults for plain HTTP access
-   * <p>
-   * Note: In most cases it is not required to do explicit optimize
-   * @throws IOException If there is a low-level I/O error.
-   */
-  public UpdateResponse optimize( ) throws SolrServerException, IOException {
-    return optimize(true, true, 1);
-  }
-  
-  /** 
-   * Performs an explicit commit, causing pending documents to be committed for indexing
-   * @param waitFlush  block until index changes are flushed to disk
-   * @param waitSearcher  block until a new searcher is opened and registered as the main query searcher, making the changes visible 
-   * @throws IOException If there is a low-level I/O error.
-   */
-  public UpdateResponse commit( boolean waitFlush, boolean waitSearcher ) throws SolrServerException, IOException {
-    return new UpdateRequest().setAction( UpdateRequest.ACTION.COMMIT, waitFlush, waitSearcher ).process( this );
-  }
-
-  /**
-   * Performs an explicit commit, causing pending documents to be committed for indexing
-   * @param waitFlush  block until index changes are flushed to disk
-   * @param waitSearcher  block until a new searcher is opened and registered as the main query searcher, making the changes visible
-   * @param softCommit makes index changes visible while neither fsync-ing index files nor writing a new index descriptor
-   * @throws IOException If there is a low-level I/O error.
-   */
-  public UpdateResponse commit( boolean waitFlush, boolean waitSearcher, boolean softCommit ) throws SolrServerException, IOException {
-    return new UpdateRequest().setAction( UpdateRequest.ACTION.COMMIT, waitFlush, waitSearcher, softCommit ).process( this );
-  }
-
-  /** 
-   * Performs an explicit optimize, causing a merge of all segments to one.
-   * <p>
-   * Note: In most cases it is not required to do explicit optimize
-   * @param waitFlush  block until index changes are flushed to disk
-   * @param waitSearcher  block until a new searcher is opened and registered as the main query searcher, making the changes visible 
-   * @throws IOException If there is a low-level I/O error.
-   */
-  public UpdateResponse optimize( boolean waitFlush, boolean waitSearcher ) throws SolrServerException, IOException {
-    return optimize(waitFlush, waitSearcher, 1);
-  }
-
-  /** 
-   * Performs an explicit optimize, causing a merge of all segments to one.
-   * <p>
-   * Note: In most cases it is not required to do explicit optimize
-   * @param waitFlush  block until index changes are flushed to disk
-   * @param waitSearcher  block until a new searcher is opened and registered as the main query searcher, making the changes visible 
-   * @param maxSegments  optimizes down to at most this number of segments
-   * @throws IOException If there is a low-level I/O error.
-   */
-  public UpdateResponse optimize(boolean waitFlush, boolean waitSearcher, int maxSegments ) throws SolrServerException, IOException {
-    return new UpdateRequest().setAction( UpdateRequest.ACTION.OPTIMIZE, waitFlush, waitSearcher, maxSegments ).process( this );
-  }
-  
-  /**
-   * Performs a rollback of all non-committed documents pending.
-   * <p>
-   * Note that this is not a true rollback as in databases. Content you have previously
-   * added may have been committed due to autoCommit, buffer full, other client performing
-   * a commit etc.
-   * @throws IOException If there is a low-level I/O error.
-   */
-  public UpdateResponse rollback() throws SolrServerException, IOException {
-    return new UpdateRequest().rollback().process( this );
-  }
-  
-  /**
-   * Deletes a single document by unique ID
-   * @param id  the ID of the document to delete
-   * @throws IOException If there is a low-level I/O error.
-   */
-  public UpdateResponse deleteById(String id) throws SolrServerException, IOException {
-    return deleteById(id, -1);
-  }
-
-  /**
-   * Deletes a single document by unique ID, specifying max time before commit
-   * @param id  the ID of the document to delete
-   * @param commitWithinMs  max time (in ms) before a commit will happen 
-   * @throws IOException If there is a low-level I/O error.
-   * @since 3.6
-   */
-  public UpdateResponse deleteById(String id, int commitWithinMs) throws SolrServerException, IOException {
-    UpdateRequest req = new UpdateRequest();
-    req.deleteById(id);
-    req.setCommitWithin(commitWithinMs);
-    return req.process(this);
-  }
-
-  /**
-   * Deletes a list of documents by unique ID
-   * @param ids  the list of document IDs to delete 
-   * @throws IOException If there is a low-level I/O error.
-   */
-  public UpdateResponse deleteById(List<String> ids) throws SolrServerException, IOException {
-    return deleteById(ids, -1);
-  }
-
-  /**
-   * Deletes a list of documents by unique ID, specifying max time before commit
-   * @param ids  the list of document IDs to delete 
-   * @param commitWithinMs  max time (in ms) before a commit will happen 
-   * @throws IOException If there is a low-level I/O error.
-   * @since 3.6
-   */
-  public UpdateResponse deleteById(List<String> ids, int commitWithinMs) throws SolrServerException, IOException {
-    UpdateRequest req = new UpdateRequest();
-    req.deleteById(ids);
-    req.setCommitWithin(commitWithinMs);
-    return req.process(this);
-  }
-
-  /**
-   * Deletes documents from the index based on a query
-   * @param query  the query expressing what documents to delete
-   * @throws IOException If there is a low-level I/O error.
-   */
-  public UpdateResponse deleteByQuery(String query) throws SolrServerException, IOException {
-    return deleteByQuery(query, -1);
-  }
-
-  /**
-   * Deletes documents from the index based on a query, specifying max time before commit
-   * @param query  the query expressing what documents to delete
-   * @param commitWithinMs  max time (in ms) before a commit will happen 
-   * @throws IOException If there is a low-level I/O error.
-   * @since 3.6
-   */
-  public UpdateResponse deleteByQuery(String query, int commitWithinMs) throws SolrServerException, IOException {
-    UpdateRequest req = new UpdateRequest();
-    req.deleteByQuery(query);
-    req.setCommitWithin(commitWithinMs);
-    return req.process(this);
-  }
-
-  /**
-   * Issues a ping request to check if the server is alive
-   * @throws IOException If there is a low-level I/O error.
-   */
-  public SolrPingResponse ping() throws SolrServerException, IOException {
-    return new SolrPing().process( this );
-  }
-
-  /**
-   * Performs a query to the Solr server
-   * @param params  an object holding all key/value parameters to send along the request
-   */
-  public QueryResponse query(SolrParams params) throws SolrServerException {
-    return new QueryRequest( params ).process( this );
-  }
-  
-  /**
-   * Performs a query to the Solr server
-   * @param params  an object holding all key/value parameters to send along the request
-   * @param method  specifies the HTTP method to use for the request, such as GET or POST
-   */
-  public QueryResponse query(SolrParams params, METHOD method) throws SolrServerException {
-    return new QueryRequest( params, method ).process( this );
-  }
-
-  /**
-   * Query solr, and stream the results.  Unlike the standard query, this will 
-   * send events for each Document rather then add them to the QueryResponse.
-   * 
-   * Although this function returns a 'QueryResponse' it should be used with care
-   * since it excludes anything that was passed to callback.  Also note that
-   * future version may pass even more info to the callback and may not return 
-   * the results in the QueryResponse.
-   *
-   * @since solr 4.0
-   */
-  public QueryResponse queryAndStreamResponse( SolrParams params, StreamingResponseCallback callback ) throws SolrServerException, IOException
-  {
-    ResponseParser parser = new StreamingBinaryResponseParser( callback );
-    QueryRequest req = new QueryRequest( params );
-    req.setStreamingResponseCallback( callback );
-    req.setResponseParser( parser );    
-    return req.process(this);
-  }
-
-  /**
-   * SolrServer implementations need to implement how a request is actually processed
-   */ 
-  public abstract NamedList<Object> request( final SolrRequest request ) throws SolrServerException, IOException;
-
-  public DocumentObjectBinder getBinder() {
-    if(binder == null){
-      binder = new DocumentObjectBinder();
-    }
-    return binder;
-  }
-  
-  /**
-   * Release allocated resources.
-   * 
-   * @since solr 4.0
-   */
-  public abstract void shutdown();
+@Deprecated
+public abstract class SolrServer extends SolrClient {
 }

Modified: lucene/dev/branches/branch_5x/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java?rev=1648706&r1=1648705&r2=1648706&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java (original)
+++ lucene/dev/branches/branch_5x/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java Wed Dec 31 14:31:03 2014
@@ -1,5 +1,3 @@
-package org.apache.solr.client.solrj.impl;
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -17,1140 +15,47 @@ package org.apache.solr.client.solrj.imp
  * limitations under the License.
  */
 
-import java.io.IOException;
-import java.net.ConnectException;
-import java.net.SocketException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Random;
-import java.util.Set;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeoutException;
+package org.apache.solr.client.solrj.impl;
 
-import org.apache.http.NoHttpResponseException;
 import org.apache.http.client.HttpClient;
-import org.apache.http.conn.ConnectTimeoutException;
-import org.apache.solr.client.solrj.ResponseParser;
-import org.apache.solr.client.solrj.SolrRequest;
-import org.apache.solr.client.solrj.SolrServer;
-import org.apache.solr.client.solrj.SolrServerException;
-import org.apache.solr.client.solrj.request.AbstractUpdateRequest;
-import org.apache.solr.client.solrj.request.IsUpdateRequest;
-import org.apache.solr.client.solrj.request.RequestWriter;
-import org.apache.solr.client.solrj.request.UpdateRequest;
-import org.apache.solr.client.solrj.util.ClientUtils;
-import org.apache.solr.common.SolrException;
-import org.apache.solr.common.SolrException.ErrorCode;
-import org.apache.solr.common.cloud.Aliases;
-import org.apache.solr.common.cloud.ClusterState;
-import org.apache.solr.common.cloud.DocCollection;
-import org.apache.solr.common.cloud.DocRouter;
-import org.apache.solr.common.cloud.ImplicitDocRouter;
-import org.apache.solr.common.cloud.Replica;
-import org.apache.solr.common.cloud.Slice;
-import org.apache.solr.common.cloud.ZkCoreNodeProps;
-import org.apache.solr.common.cloud.ZkNodeProps;
-import org.apache.solr.common.cloud.ZkStateReader;
-import org.apache.solr.common.cloud.ZooKeeperException;
-import org.apache.solr.common.params.ModifiableSolrParams;
-import org.apache.solr.common.params.ShardParams;
-import org.apache.solr.common.params.SolrParams;
-import org.apache.solr.common.params.UpdateParams;
-import org.apache.solr.common.util.NamedList;
-import org.apache.solr.common.util.SolrjNamedThreadFactory;
-import org.apache.solr.common.util.StrUtils;
-import org.apache.zookeeper.KeeperException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
+import java.util.Collection;
 
 /**
- * SolrJ client class to communicate with SolrCloud.
- * Instances of this class communicate with Zookeeper to discover
- * Solr endpoints for SolrCloud collections, and then use the 
- * {@link LBHttpSolrServer} to issue requests.
- * 
- * This class assumes the id field for your documents is called
- * 'id' - if this is not the case, you must set the right name
- * with {@link #setIdField(String)}.
+ * @deprecated Use {@link org.apache.solr.client.solrj.impl.CloudSolrClient}
  */
-@SuppressWarnings("serial")
-public class CloudSolrServer extends SolrServer {
-  protected static final Logger log = LoggerFactory.getLogger(CloudSolrServer.class);
-
-  private volatile ZkStateReader zkStateReader;
-  private String zkHost; // the zk server connect string
-  private int zkConnectTimeout = 10000;
-  private int zkClientTimeout = 10000;
-  private volatile String defaultCollection;
-  private final LBHttpSolrServer lbServer;
-  private final boolean shutdownLBHttpSolrServer;
-  private HttpClient myClient;
-  private final boolean clientIsInternal;
-  //no of times collection state to be reloaded if stale state error is received
-  private static final int MAX_STALE_RETRIES = 5;
-  Random rand = new Random();
-  
-  private final boolean updatesToLeaders;
-  private boolean parallelUpdates = true;
-  private ExecutorService threadPool = Executors
-      .newCachedThreadPool(new SolrjNamedThreadFactory(
-          "CloudSolrServer ThreadPool"));
-  private String idField = "id";
-  public static final String STATE_VERSION = "_stateVer_";
-  private final Set<String> NON_ROUTABLE_PARAMS;
-  {
-    NON_ROUTABLE_PARAMS = new HashSet<>();
-    NON_ROUTABLE_PARAMS.add(UpdateParams.EXPUNGE_DELETES);
-    NON_ROUTABLE_PARAMS.add(UpdateParams.MAX_OPTIMIZE_SEGMENTS);
-    NON_ROUTABLE_PARAMS.add(UpdateParams.COMMIT);
-    NON_ROUTABLE_PARAMS.add(UpdateParams.WAIT_SEARCHER);
-    NON_ROUTABLE_PARAMS.add(UpdateParams.OPEN_SEARCHER);
-    
-    NON_ROUTABLE_PARAMS.add(UpdateParams.SOFT_COMMIT);
-    NON_ROUTABLE_PARAMS.add(UpdateParams.PREPARE_COMMIT);
-    NON_ROUTABLE_PARAMS.add(UpdateParams.OPTIMIZE);
-    
-    // Not supported via SolrCloud
-    // NON_ROUTABLE_PARAMS.add(UpdateParams.ROLLBACK);
-
-  }
-  private volatile long timeToLive = 60* 1000L;
-
-
-  protected Map<String, ExpiringCachedDocCollection> collectionStateCache = new ConcurrentHashMap<String, ExpiringCachedDocCollection>(){
-    @Override
-    public ExpiringCachedDocCollection get(Object key) {
-      ExpiringCachedDocCollection val = super.get(key);
-      if(val == null) return null;
-      if(val.isExpired(timeToLive)) {
-        super.remove(key);
-        return null;
-      }
-      return val;
-    }
-
-  };
-
-  class ExpiringCachedDocCollection {
-    DocCollection cached;
-    long cachedAt;
-
-    ExpiringCachedDocCollection(DocCollection cached) {
-      this.cached = cached;
-      this.cachedAt = System.currentTimeMillis();
-    }
-
-    boolean isExpired(long timeToLive) {
-      return (System.currentTimeMillis() - cachedAt) > timeToLive;
-    }
-  }
+@Deprecated
+public class CloudSolrServer extends CloudSolrClient {
 
-  /**
-   * Create a new client object that connects to Zookeeper and is always aware
-   * of the SolrCloud state. If there is a fully redundant Zookeeper quorum and
-   * SolrCloud has enough replicas for every shard in a collection, there is no
-   * single point of failure. Updates will be sent to shard leaders by default.
-   * 
-   * @param zkHost
-   *          The client endpoint of the zookeeper quorum containing the cloud
-   *          state. The full specification for this string is one or more comma
-   *          separated HOST:PORT values, followed by an optional chroot value
-   *          that starts with a forward slash. Using a chroot allows multiple
-   *          applications to coexist in one ensemble. For full details, see the
-   *          Zookeeper documentation. Some examples:
-   *          <p/>
-   *          "host1:2181"
-   *          <p/>
-   *          "host1:2181,host2:2181,host3:2181/mysolrchroot"
-   *          <p/>
-   *          "zoo1.example.com:2181,zoo2.example.com:2181,zoo3.example.com:2181"
-   */
   public CloudSolrServer(String zkHost) {
-      this.zkHost = zkHost;
-      this.clientIsInternal = true;
-      this.myClient = HttpClientUtil.createClient(null);
-      this.lbServer = new LBHttpSolrServer(myClient);
-      this.lbServer.setRequestWriter(new BinaryRequestWriter());
-      this.lbServer.setParser(new BinaryResponseParser());
-      this.updatesToLeaders = true;
-      shutdownLBHttpSolrServer = true;
-      lbServer.addQueryParams(STATE_VERSION);
+    super(zkHost);
   }
 
-  /**
-   * Create a new client object that connects to Zookeeper and is always aware
-   * of the SolrCloud state. If there is a fully redundant Zookeeper quorum and
-   * SolrCloud has enough replicas for every shard in a collection, there is no
-   * single point of failure. Updates will be sent to shard leaders by default.
-   *
-   * @param zkHost
-   *          The client endpoint of the zookeeper quorum containing the cloud
-   *          state. The full specification for this string is one or more comma
-   *          separated HOST:PORT values, followed by an optional chroot value
-   *          that starts with a forward slash. Using a chroot allows multiple
-   *          applications to coexist in one ensemble. For full details, see the
-   *          Zookeeper documentation. Some examples:
-   *          <p/>
-   *          "host1:2181"
-   *          <p/>
-   *          "host1:2181,host2:2181,host3:2181/mysolrchroot"
-   *          <p/>
-   *          "zoo1.example.com:2181,zoo2.example.com:2181,zoo3.example.com:2181"
-   * @param httpClient
-   *          the {@link HttpClient} instance to be used for all requests. The
-   *          provided httpClient should use a multi-threaded connection manager.
-   */
-  public CloudSolrServer(String zkHost, HttpClient httpClient)  {
-    this.zkHost = zkHost;
-    this.clientIsInternal = httpClient == null;
-    this.myClient = httpClient == null ? HttpClientUtil.createClient(null) : httpClient;
-    this.lbServer = new LBHttpSolrServer(myClient);
-    this.lbServer.setRequestWriter(new BinaryRequestWriter());
-    this.lbServer.setParser(new BinaryResponseParser());
-    this.updatesToLeaders = true;
-    shutdownLBHttpSolrServer = true;
-    lbServer.addQueryParams(STATE_VERSION);
+  public CloudSolrServer(String zkHost, HttpClient httpClient) {
+    super(zkHost, httpClient);
   }
-  
-  /**
-   * Create a new client object using multiple string values in a Collection
-   * instead of a standard zkHost connection string. Note that this method will
-   * not be used if there is only one String argument - that will use
-   * {@link #CloudSolrServer(String)} instead.
-   * 
-   * @param zkHosts
-   *          A Java Collection (List, Set, etc) of HOST:PORT strings, one for
-   *          each host in the zookeeper ensemble. Note that with certain
-   *          Collection types like HashSet, the order of hosts in the final
-   *          connect string may not be in the same order you added them.
-   * @param chroot
-   *          A chroot value for zookeeper, starting with a forward slash. If no
-   *          chroot is required, use null.
-   * @throws IllegalArgumentException
-   *           if the chroot value does not start with a forward slash.
-   * @see #CloudSolrServer(String)
-   */
+
   public CloudSolrServer(Collection<String> zkHosts, String chroot) {
-    this(zkHosts, chroot, null);
+    super(zkHosts, chroot);
   }
 
-  /**
-   * Create a new client object using multiple string values in a Collection
-   * instead of a standard zkHost connection string. Note that this method will
-   * not be used if there is only one String argument - that will use
-   * {@link #CloudSolrServer(String)} instead.
-   *
-   * @param zkHosts
-   *          A Java Collection (List, Set, etc) of HOST:PORT strings, one for
-   *          each host in the zookeeper ensemble. Note that with certain
-   *          Collection types like HashSet, the order of hosts in the final
-   *          connect string may not be in the same order you added them.
-   * @param chroot
-   *          A chroot value for zookeeper, starting with a forward slash. If no
-   *          chroot is required, use null.
-   * @param httpClient
-   *          the {@link HttpClient} instance to be used for all requests. The provided httpClient should use a
-   *          multi-threaded connection manager.
-   * @throws IllegalArgumentException
-   *           if the chroot value does not start with a forward slash.
-   * @see #CloudSolrServer(String)
-   */
   public CloudSolrServer(Collection<String> zkHosts, String chroot, HttpClient httpClient) {
-    StringBuilder zkBuilder = new StringBuilder();
-    int lastIndexValue = zkHosts.size() - 1;
-    int i = 0;
-    for (String zkHost : zkHosts) {
-      zkBuilder.append(zkHost);
-      if (i < lastIndexValue) {
-        zkBuilder.append(",");
-      }
-      i++;
-    }
-    if (chroot != null) {
-      if (chroot.startsWith("/")) {
-        zkBuilder.append(chroot);
-      } else {
-        throw new IllegalArgumentException(
-            "The chroot must start with a forward slash.");
-      }
-    }
-
-    /* Log the constructed connection string and then initialize. */
-    log.info("Final constructed zkHost string: " + zkBuilder.toString());
-
-    this.zkHost = zkBuilder.toString();
-    this.clientIsInternal = httpClient == null;
-    this.myClient = httpClient == null ? HttpClientUtil.createClient(null) : httpClient;
-    this.lbServer = new LBHttpSolrServer(myClient);
-    this.lbServer.setRequestWriter(new BinaryRequestWriter());
-    this.lbServer.setParser(new BinaryResponseParser());
-    this.updatesToLeaders = true;
-    shutdownLBHttpSolrServer = true;
+    super(zkHosts, chroot, httpClient);
   }
-  
-  /**
-   * @param zkHost
-   *          A zookeeper client endpoint.
-   * @param updatesToLeaders
-   *          If true, sends updates only to shard leaders.
-   * @see #CloudSolrServer(String) for full description and details on zkHost
-   */
+
   public CloudSolrServer(String zkHost, boolean updatesToLeaders) {
-    this(zkHost, updatesToLeaders, null);
+    super(zkHost, updatesToLeaders);
   }
 
-  /**
-   * @param zkHost
-   *          A zookeeper client endpoint.
-   * @param updatesToLeaders
-   *          If true, sends updates only to shard leaders.
-   * @param httpClient
-   *          the {@link HttpClient} instance to be used for all requests. The provided httpClient should use a
-   *          multi-threaded connection manager.
-   * @see #CloudSolrServer(String) for full description and details on zkHost
-   */
   public CloudSolrServer(String zkHost, boolean updatesToLeaders, HttpClient httpClient) {
-    this.zkHost = zkHost;
-    this.clientIsInternal = httpClient == null;
-    this.myClient = httpClient == null ? HttpClientUtil.createClient(null) : httpClient;
-    this.lbServer = new LBHttpSolrServer(myClient);
-    this.lbServer.setRequestWriter(new BinaryRequestWriter());
-    this.lbServer.setParser(new BinaryResponseParser());
-    this.updatesToLeaders = updatesToLeaders;
-    shutdownLBHttpSolrServer = true;
-    lbServer.addQueryParams(STATE_VERSION);
-  }
-
-  /**Sets the cache ttl for DocCollection Objects cached  . This is only applicable for collections which are persisted outside of clusterstate.json
-   * @param seconds ttl value in seconds
-   */
-  public void setCollectionCacheTTl(int seconds){
-    assert seconds > 0;
-    timeToLive = seconds*1000L;
-  }
-
-  /**
-   * @param zkHost
-   *          A zookeeper client endpoint.
-   * @param lbServer
-   *          LBHttpSolrServer instance for requests.
-   * @see #CloudSolrServer(String) for full description and details on zkHost
-   */
-  public CloudSolrServer(String zkHost, LBHttpSolrServer lbServer) {
-    this(zkHost, lbServer, true);
-  }
-  
-  /**
-   * @param zkHost
-   *          A zookeeper client endpoint.
-   * @param lbServer
-   *          LBHttpSolrServer instance for requests.
-   * @param updatesToLeaders
-   *          If true, sends updates only to shard leaders.
-   * @see #CloudSolrServer(String) for full description and details on zkHost
-   */
-  public CloudSolrServer(String zkHost, LBHttpSolrServer lbServer, boolean updatesToLeaders) {
-    this.zkHost = zkHost;
-    this.lbServer = lbServer;
-    this.updatesToLeaders = updatesToLeaders;
-    shutdownLBHttpSolrServer = false;
-    this.clientIsInternal = false;
-    lbServer.addQueryParams(STATE_VERSION);
-  }
-  
-  public ResponseParser getParser() {
-    return lbServer.getParser();
-  }
-  
-  /**
-   * Note: This setter method is <b>not thread-safe</b>.
-   * 
-   * @param processor
-   *          Default Response Parser chosen to parse the response if the parser
-   *          were not specified as part of the request.
-   * @see org.apache.solr.client.solrj.SolrRequest#getResponseParser()
-   */
-  public void setParser(ResponseParser processor) {
-    lbServer.setParser(processor);
-  }
-  
-  public RequestWriter getRequestWriter() {
-    return lbServer.getRequestWriter();
-  }
-  
-  public void setRequestWriter(RequestWriter requestWriter) {
-    lbServer.setRequestWriter(requestWriter);
-  }
-
-  /**
-   * @return the zkHost value used to connect to zookeeper.
-   */
-  public String getZkHost() {
-    return zkHost;
-  }
-
-  public ZkStateReader getZkStateReader() {
-    return zkStateReader;
-  }
-
-  /**
-   * @param idField the field to route documents on.
-   */
-  public void setIdField(String idField) {
-    this.idField = idField;
-  }
-
-  /**
-   * @return the field that updates are routed on.
-   */
-  public String getIdField() {
-    return idField;
-  }
-  
-  /** Sets the default collection for request */
-  public void setDefaultCollection(String collection) {
-    this.defaultCollection = collection;
-  }
-
-  /** Gets the default collection for request */
-  public String getDefaultCollection() {
-    return defaultCollection;
-  }
-
-  /** Set the connect timeout to the zookeeper ensemble in ms */
-  public void setZkConnectTimeout(int zkConnectTimeout) {
-    this.zkConnectTimeout = zkConnectTimeout;
-  }
-
-  /** Set the timeout to the zookeeper ensemble in ms */
-  public void setZkClientTimeout(int zkClientTimeout) {
-    this.zkClientTimeout = zkClientTimeout;
-  }
-
-  /**
-   * Connect to the zookeeper ensemble.
-   * This is an optional method that may be used to force a connect before any other requests are sent.
-   *
-   */
-  public void connect() {
-    if (zkStateReader == null) {
-      synchronized (this) {
-        if (zkStateReader == null) {
-          ZkStateReader zk = null;
-          try {
-            zk = new ZkStateReader(zkHost, zkClientTimeout,
-                zkConnectTimeout);
-            zk.createClusterStateWatchersAndUpdate();
-            zkStateReader = zk;
-          } catch (InterruptedException e) {
-            if (zk != null) zk.close();
-            Thread.currentThread().interrupt();
-            throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR,
-                "", e);
-          } catch (KeeperException e) {
-            if (zk != null) zk.close();
-            throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR,
-                "", e);
-          } catch (IOException e) {
-            if (zk != null) zk.close();
-            throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR,
-                "", e);
-          } catch (TimeoutException e) {
-            if (zk != null) zk.close();
-            throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR,
-                "", e);
-          } catch (Exception e) {
-            if (zk != null) zk.close();
-            // do not wrap because clients may be relying on the underlying exception being thrown
-            throw e;
-          }
-        }
-      }
-    }
-  }
-
-  public void setParallelUpdates(boolean parallelUpdates) {
-    this.parallelUpdates = parallelUpdates;
-  }
-
-  private NamedList<Object> directUpdate(AbstractUpdateRequest request, ClusterState clusterState) throws SolrServerException {
-    UpdateRequest updateRequest = (UpdateRequest) request;
-    ModifiableSolrParams params = (ModifiableSolrParams) request.getParams();
-    ModifiableSolrParams routableParams = new ModifiableSolrParams();
-    ModifiableSolrParams nonRoutableParams = new ModifiableSolrParams();
-
-    if(params != null) {
-      nonRoutableParams.add(params);
-      routableParams.add(params);
-      for(String param : NON_ROUTABLE_PARAMS) {
-        routableParams.remove(param);
-      }
-    }
-
-    String collection = nonRoutableParams.get(UpdateParams.COLLECTION, defaultCollection);
-    if (collection == null) {
-      throw new SolrServerException("No collection param specified on request and no default collection has been set.");
-    }
-
-
-    //Check to see if the collection is an alias.
-    Aliases aliases = zkStateReader.getAliases();
-    if(aliases != null) {
-      Map<String, String> collectionAliases = aliases.getCollectionAliasMap();
-      if(collectionAliases != null && collectionAliases.containsKey(collection)) {
-        collection = collectionAliases.get(collection);
-      }
-    }
-
-    DocCollection col = getDocCollection(clusterState, collection);
-
-    DocRouter router = col.getRouter();
-    
-    if (router instanceof ImplicitDocRouter) {
-      // short circuit as optimization
-      return null;
-    }
-
-    //Create the URL map, which is keyed on slice name.
-    //The value is a list of URLs for each replica in the slice.
-    //The first value in the list is the leader for the slice.
-    Map<String,List<String>> urlMap = buildUrlMap(col);
-    if (urlMap == null) {
-      // we could not find a leader yet - use unoptimized general path
-      return null;
-    }
-
-    NamedList<Throwable> exceptions = new NamedList<>();
-    NamedList<NamedList> shardResponses = new NamedList<>();
-
-    Map<String, LBHttpSolrServer.Req> routes = updateRequest.getRoutes(router, col, urlMap, routableParams, this.idField);
-    if (routes == null) {
-      return null;
-    }
-
-    long start = System.nanoTime();
-
-    if (parallelUpdates) {
-      final Map<String, Future<NamedList<?>>> responseFutures = new HashMap<>(routes.size());
-      for (final Map.Entry<String, LBHttpSolrServer.Req> entry : routes.entrySet()) {
-        final String url = entry.getKey();
-        final LBHttpSolrServer.Req lbRequest = entry.getValue();
-        responseFutures.put(url, threadPool.submit(new Callable<NamedList<?>>() {
-          @Override
-          public NamedList<?> call() throws Exception {
-            return lbServer.request(lbRequest).getResponse();
-          }
-        }));
-      }
-
-      for (final Map.Entry<String, Future<NamedList<?>>> entry: responseFutures.entrySet()) {
-        final String url = entry.getKey();
-        final Future<NamedList<?>> responseFuture = entry.getValue();
-        try {
-          shardResponses.add(url, responseFuture.get());
-        } catch (InterruptedException e) {
-          Thread.currentThread().interrupt();
-          throw new RuntimeException(e);
-        } catch (ExecutionException e) {
-          exceptions.add(url, e.getCause());
-        }
-      }
-
-      if (exceptions.size() > 0) {
-        throw new RouteException(ErrorCode.SERVER_ERROR, exceptions, routes);
-      }
-    } else {
-      for (Map.Entry<String, LBHttpSolrServer.Req> entry : routes.entrySet()) {
-        String url = entry.getKey();
-        LBHttpSolrServer.Req lbRequest = entry.getValue();
-        try {
-          NamedList<Object> rsp = lbServer.request(lbRequest).getResponse();
-          shardResponses.add(url, rsp);
-        } catch (Exception e) {
-          throw new SolrServerException(e);
-        }
-      }
-    }
-
-    UpdateRequest nonRoutableRequest = null;
-    List<String> deleteQuery = updateRequest.getDeleteQuery();
-    if (deleteQuery != null && deleteQuery.size() > 0) {
-      UpdateRequest deleteQueryRequest = new UpdateRequest();
-      deleteQueryRequest.setDeleteQuery(deleteQuery);
-      nonRoutableRequest = deleteQueryRequest;
-    }
-    
-    Set<String> paramNames = nonRoutableParams.getParameterNames();
-    
-    Set<String> intersection = new HashSet<>(paramNames);
-    intersection.retainAll(NON_ROUTABLE_PARAMS);
-    
-    if (nonRoutableRequest != null || intersection.size() > 0) {
-      if (nonRoutableRequest == null) {
-        nonRoutableRequest = new UpdateRequest();
-      }
-      nonRoutableRequest.setParams(nonRoutableParams);
-      List<String> urlList = new ArrayList<>();
-      urlList.addAll(routes.keySet());
-      Collections.shuffle(urlList, rand);
-      LBHttpSolrServer.Req req = new LBHttpSolrServer.Req(nonRoutableRequest, urlList);
-      try {
-        LBHttpSolrServer.Rsp rsp = lbServer.request(req);
-        shardResponses.add(urlList.get(0), rsp.getResponse());
-      } catch (Exception e) {
-        throw new SolrException(ErrorCode.SERVER_ERROR, urlList.get(0), e);
-      }
-    }
-
-    long end = System.nanoTime();
-
-    RouteResponse rr =  condenseResponse(shardResponses, (long)((end - start)/1000000));
-    rr.setRouteResponses(shardResponses);
-    rr.setRoutes(routes);
-    return rr;
-  }
-
-  private Map<String,List<String>> buildUrlMap(DocCollection col) {
-    Map<String, List<String>> urlMap = new HashMap<>();
-    Collection<Slice> slices = col.getActiveSlices();
-    Iterator<Slice> sliceIterator = slices.iterator();
-    while (sliceIterator.hasNext()) {
-      Slice slice = sliceIterator.next();
-      String name = slice.getName();
-      List<String> urls = new ArrayList<>();
-      Replica leader = slice.getLeader();
-      if (leader == null) {
-        // take unoptimized general path - we cannot find a leader yet
-        return null;
-      }
-      ZkCoreNodeProps zkProps = new ZkCoreNodeProps(leader);
-      String url = zkProps.getCoreUrl();
-      urls.add(url);
-      Collection<Replica> replicas = slice.getReplicas();
-      Iterator<Replica> replicaIterator = replicas.iterator();
-      while (replicaIterator.hasNext()) {
-        Replica replica = replicaIterator.next();
-        if (!replica.getNodeName().equals(leader.getNodeName()) &&
-            !replica.getName().equals(leader.getName())) {
-          ZkCoreNodeProps zkProps1 = new ZkCoreNodeProps(replica);
-          String url1 = zkProps1.getCoreUrl();
-          urls.add(url1);
-        }
-      }
-      urlMap.put(name, urls);
-    }
-    return urlMap;
-  }
-
-  public RouteResponse condenseResponse(NamedList response, long timeMillis) {
-    RouteResponse condensed = new RouteResponse();
-    int status = 0;
-    Integer rf = null;
-    Integer minRf = null;
-    for(int i=0; i<response.size(); i++) {
-      NamedList shardResponse = (NamedList)response.getVal(i);
-      NamedList header = (NamedList)shardResponse.get("responseHeader");      
-      Integer shardStatus = (Integer)header.get("status");
-      int s = shardStatus.intValue();
-      if(s > 0) {
-          status = s;
-      }
-      Object rfObj = header.get(UpdateRequest.REPFACT);
-      if (rfObj != null && rfObj instanceof Integer) {
-        Integer routeRf = (Integer)rfObj;
-        if (rf == null || routeRf < rf)
-          rf = routeRf;
-      }
-      minRf = (Integer)header.get(UpdateRequest.MIN_REPFACT);
-    }
-
-    NamedList cheader = new NamedList();
-    cheader.add("status", status);
-    cheader.add("QTime", timeMillis);
-    if (rf != null)
-      cheader.add(UpdateRequest.REPFACT, rf);
-    if (minRf != null)
-      cheader.add(UpdateRequest.MIN_REPFACT, minRf);
-    
-    condensed.add("responseHeader", cheader);
-    return condensed;
-  }
-
-  public static class RouteResponse extends NamedList {
-    private NamedList routeResponses;
-    private Map<String, LBHttpSolrServer.Req> routes;
-
-    public void setRouteResponses(NamedList routeResponses) {
-      this.routeResponses = routeResponses;
-    }
-
-    public NamedList getRouteResponses() {
-      return routeResponses;
-    }
-
-    public void setRoutes(Map<String, LBHttpSolrServer.Req> routes) {
-      this.routes = routes;
-    }
-
-    public Map<String, LBHttpSolrServer.Req> getRoutes() {
-      return routes;
-    }
-
-  }
-
-  public static class RouteException extends SolrException {
-
-    private NamedList<Throwable> throwables;
-    private Map<String, LBHttpSolrServer.Req> routes;
-
-    public RouteException(ErrorCode errorCode, NamedList<Throwable> throwables, Map<String, LBHttpSolrServer.Req> routes){
-      super(errorCode, throwables.getVal(0).getMessage(), throwables.getVal(0));
-      this.throwables = throwables;
-      this.routes = routes;
-    }
-
-    public NamedList<Throwable> getThrowables() {
-      return throwables;
-    }
-
-    public Map<String, LBHttpSolrServer.Req> getRoutes() {
-      return this.routes;
-    }
+    super(zkHost, updatesToLeaders, httpClient);
   }
 
-  @Override
-  public NamedList<Object> request(SolrRequest request) throws SolrServerException, IOException {
-    SolrParams reqParams = request.getParams();
-    String collection = (reqParams != null) ? reqParams.get("collection", getDefaultCollection()) : getDefaultCollection();
-    return requestWithRetryOnStaleState(request, 0, collection);
+  public CloudSolrServer(String zkHost, LBHttpSolrClient lbClient) {
+    super(zkHost, lbClient);
   }
 
-  /**
-   * As this class doesn't watch external collections on the client side,
-   * there's a chance that the request will fail due to cached stale state,
-   * which means the state must be refreshed from ZK and retried.
-   */
-  protected NamedList<Object> requestWithRetryOnStaleState(SolrRequest request, int retryCount, String collection)
-      throws SolrServerException, IOException {
-
-    connect(); // important to call this before you start working with the ZkStateReader
-
-    // build up a _stateVer_ param to pass to the server containing all of the
-    // external collection state versions involved in this request, which allows
-    // the server to notify us that our cached state for one or more of the external
-    // collections is stale and needs to be refreshed ... this code has no impact on internal collections
-    String stateVerParam = null;
-    List<DocCollection> requestedCollections = null;
-    if (collection != null && !request.getPath().startsWith("/admin")) { // don't do _stateVer_ checking for admin requests
-      Set<String> requestedCollectionNames = getCollectionList(getZkStateReader().getClusterState(), collection);
-
-      StringBuilder stateVerParamBuilder = null;
-      for (String requestedCollection : requestedCollectionNames) {
-        // track the version of state we're using on the client side using the _stateVer_ param
-        DocCollection coll = getDocCollection(getZkStateReader().getClusterState(), requestedCollection);
-        int collVer = coll.getZNodeVersion();
-        if (coll.getStateFormat()>1) {
-          if(requestedCollections == null) requestedCollections = new ArrayList<>(requestedCollectionNames.size());
-          requestedCollections.add(coll);
-
-          if (stateVerParamBuilder == null) {
-            stateVerParamBuilder = new StringBuilder();
-          } else {
-            stateVerParamBuilder.append("|"); // hopefully pipe is not an allowed char in a collection name
-          }
-
-          stateVerParamBuilder.append(coll.getName()).append(":").append(collVer);
-        }
-      }
-
-      if (stateVerParamBuilder != null) {
-        stateVerParam = stateVerParamBuilder.toString();
-      }
-    }
-
-    if (request.getParams() instanceof ModifiableSolrParams) {
-      ModifiableSolrParams params = (ModifiableSolrParams) request.getParams();
-      if (stateVerParam != null) {
-        params.set(STATE_VERSION, stateVerParam);
-      } else {
-        params.remove(STATE_VERSION);
-      }
-    } // else: ??? how to set this ???
-
-    NamedList<Object> resp = null;
-    try {
-      resp = sendRequest(request);
-    } catch (Exception exc) {
-
-      Throwable rootCause = SolrException.getRootCause(exc);
-      // don't do retry support for admin requests or if the request doesn't have a collection specified
-      if (collection == null || request.getPath().startsWith("/admin")) {
-        if (exc instanceof SolrServerException) {
-          throw (SolrServerException)exc;
-        } else if (exc instanceof IOException) {
-          throw (IOException)exc;
-        }else if (exc instanceof RuntimeException) {
-          throw (RuntimeException) exc;
-        }
-        else {
-          throw new SolrServerException(rootCause);
-        }
-      }
-
-      int errorCode = (rootCause instanceof SolrException) ?
-          ((SolrException)rootCause).code() : SolrException.ErrorCode.UNKNOWN.code;
-
-      log.error("Request to collection {} failed due to ("+errorCode+
-          ") {}, retry? "+retryCount, collection, rootCause.toString());
-
-      boolean wasCommError =
-          (rootCause instanceof ConnectException ||
-              rootCause instanceof ConnectTimeoutException ||
-              rootCause instanceof NoHttpResponseException ||
-              rootCause instanceof SocketException);
-
-      boolean stateWasStale = false;
-      if (retryCount < MAX_STALE_RETRIES  &&
-          requestedCollections != null    &&
-          !requestedCollections.isEmpty() &&
-          SolrException.ErrorCode.getErrorCode(errorCode) == SolrException.ErrorCode.INVALID_STATE)
-      {
-        // cached state for one or more external collections was stale
-        // re-issue request using updated state
-        stateWasStale = true;
-
-        // just re-read state for all of them, which is a little heavy handed but hopefully a rare occurrence
-        for (DocCollection ext : requestedCollections) {
-          collectionStateCache.remove(ext.getName());
-        }
-      }
-
-      // if we experienced a communication error, it's worth checking the state
-      // with ZK just to make sure the node we're trying to hit is still part of the collection
-      if (retryCount < MAX_STALE_RETRIES &&
-          !stateWasStale &&
-          requestedCollections != null &&
-          !requestedCollections.isEmpty() &&
-          wasCommError) {
-        for (DocCollection ext : requestedCollections) {
-          DocCollection latestStateFromZk = getDocCollection(zkStateReader.getClusterState(), ext.getName());
-          if (latestStateFromZk.getZNodeVersion() != ext.getZNodeVersion()) {
-            // looks like we couldn't reach the server because the state was stale == retry
-            stateWasStale = true;
-            // we just pulled state from ZK, so update the cache so that the retry uses it
-            collectionStateCache.put(ext.getName(), new ExpiringCachedDocCollection(latestStateFromZk));
-          }
-        }
-      }
-
-      if (requestedCollections != null) {
-        requestedCollections.clear(); // done with this
-      }
-
-      // if the state was stale, then we retry the request once with new state pulled from Zk
-      if (stateWasStale) {
-        log.warn("Re-trying request to  collection(s) "+collection+" after stale state error from server.");
-        resp = requestWithRetryOnStaleState(request, retryCount+1, collection);
-      } else {
-        if (exc instanceof SolrServerException) {
-          throw (SolrServerException)exc;
-        } else if (exc instanceof IOException) {
-          throw (IOException)exc;
-        } else {
-          throw new SolrServerException(rootCause);
-        }
-      }
-    }
-
-    return resp;
-  }
-
-  protected NamedList<Object> sendRequest(SolrRequest request)
-      throws SolrServerException, IOException {
-    connect();
-    
-    ClusterState clusterState = zkStateReader.getClusterState();
-    
-    boolean sendToLeaders = false;
-    List<String> replicas = null;
-    
-    if (request instanceof IsUpdateRequest) {
-      if (request instanceof UpdateRequest) {
-        NamedList<Object> response = directUpdate((AbstractUpdateRequest) request,
-            clusterState);
-        if (response != null) {
-          return response;
-        }
-      }
-      sendToLeaders = true;
-      replicas = new ArrayList<>();
-    }
-    
-    SolrParams reqParams = request.getParams();
-    if (reqParams == null) {
-      reqParams = new ModifiableSolrParams();
-    }
-    List<String> theUrlList = new ArrayList<>();
-    if (request.getPath().equals("/admin/collections")
-        || request.getPath().equals("/admin/cores")) {
-      Set<String> liveNodes = clusterState.getLiveNodes();
-      for (String liveNode : liveNodes) {
-        theUrlList.add(zkStateReader.getBaseUrlForNodeName(liveNode));
-      }
-    } else {
-      String collection = reqParams.get(UpdateParams.COLLECTION, defaultCollection);
-      
-      if (collection == null) {
-        throw new SolrServerException(
-            "No collection param specified on request and no default collection has been set.");
-      }
-      
-      Set<String> collectionsList = getCollectionList(clusterState, collection);
-      if (collectionsList.size() == 0) {
-        throw new SolrException(ErrorCode.BAD_REQUEST,
-            "Could not find collection: " + collection);
-      }
-
-      String shardKeys =  reqParams.get(ShardParams._ROUTE_);
-      if(shardKeys == null) {
-        shardKeys = reqParams.get(ShardParams.SHARD_KEYS); // deprecated
-      }
-
-      // TODO: not a big deal because of the caching, but we could avoid looking
-      // at every shard
-      // when getting leaders if we tweaked some things
-      
-      // Retrieve slices from the cloud state and, for each collection
-      // specified,
-      // add it to the Map of slices.
-      Map<String,Slice> slices = new HashMap<>();
-      for (String collectionName : collectionsList) {
-        DocCollection col = getDocCollection(clusterState, collectionName);
-        Collection<Slice> routeSlices = col.getRouter().getSearchSlices(shardKeys, reqParams , col);
-        ClientUtils.addSlices(slices, collectionName, routeSlices, true);
-      }
-      Set<String> liveNodes = clusterState.getLiveNodes();
-
-      List<String> leaderUrlList = null;
-      List<String> urlList = null;
-      List<String> replicasList = null;
-      
-      // build a map of unique nodes
-      // TODO: allow filtering by group, role, etc
-      Map<String,ZkNodeProps> nodes = new HashMap<>();
-      List<String> urlList2 = new ArrayList<>();
-      for (Slice slice : slices.values()) {
-        for (ZkNodeProps nodeProps : slice.getReplicasMap().values()) {
-          ZkCoreNodeProps coreNodeProps = new ZkCoreNodeProps(nodeProps);
-          String node = coreNodeProps.getNodeName();
-          if (!liveNodes.contains(coreNodeProps.getNodeName())
-              || !coreNodeProps.getState().equals(ZkStateReader.ACTIVE)) continue;
-          if (nodes.put(node, nodeProps) == null) {
-            if (!sendToLeaders || (sendToLeaders && coreNodeProps.isLeader())) {
-              String url;
-              if (reqParams.get(UpdateParams.COLLECTION) == null) {
-                url = ZkCoreNodeProps.getCoreUrl(
-                    nodeProps.getStr(ZkStateReader.BASE_URL_PROP),
-                    defaultCollection);
-              } else {
-                url = coreNodeProps.getCoreUrl();
-              }
-              urlList2.add(url);
-            } else if (sendToLeaders) {
-              String url;
-              if (reqParams.get(UpdateParams.COLLECTION) == null) {
-                url = ZkCoreNodeProps.getCoreUrl(
-                    nodeProps.getStr(ZkStateReader.BASE_URL_PROP),
-                    defaultCollection);
-              } else {
-                url = coreNodeProps.getCoreUrl();
-              }
-              replicas.add(url);
-            }
-          }
-        }
-      }
-      
-      if (sendToLeaders) {
-        leaderUrlList = urlList2;
-        replicasList = replicas;
-      } else {
-        urlList = urlList2;
-      }
-      
-      if (sendToLeaders) {
-        theUrlList = new ArrayList<>(leaderUrlList.size());
-        theUrlList.addAll(leaderUrlList);
-      } else {
-        theUrlList = new ArrayList<>(urlList.size());
-        theUrlList.addAll(urlList);
-      }
-      if(theUrlList.isEmpty()) {
-        throw new SolrException(SolrException.ErrorCode.INVALID_STATE, "Not enough nodes to handle the request");
-      }
-
-      Collections.shuffle(theUrlList, rand);
-      if (sendToLeaders) {
-        ArrayList<String> theReplicas = new ArrayList<>(
-            replicasList.size());
-        theReplicas.addAll(replicasList);
-        Collections.shuffle(theReplicas, rand);
-        theUrlList.addAll(theReplicas);
-      }
-      
-    }
-    
-    LBHttpSolrServer.Req req = new LBHttpSolrServer.Req(request, theUrlList);
-    LBHttpSolrServer.Rsp rsp = lbServer.request(req);
-    return rsp.getResponse();
-  }
-
-  private Set<String> getCollectionList(ClusterState clusterState,
-      String collection) {
-    // Extract each comma separated collection name and store in a List.
-    List<String> rawCollectionsList = StrUtils.splitSmart(collection, ",", true);
-    Set<String> collectionsList = new HashSet<>();
-    // validate collections
-    for (String collectionName : rawCollectionsList) {
-      if (!clusterState.getCollections().contains(collectionName)) {
-        Aliases aliases = zkStateReader.getAliases();
-        String alias = aliases.getCollectionAlias(collectionName);
-        if (alias != null) {
-          List<String> aliasList = StrUtils.splitSmart(alias, ",", true);
-          collectionsList.addAll(aliasList);
-          continue;
-        }
-
-          throw new SolrException(ErrorCode.BAD_REQUEST, "Collection not found: " + collectionName);
-        }
-
-      collectionsList.add(collectionName);
-    }
-    return collectionsList;
-  }
-
-  @Override
-  public void shutdown() {
-    if (zkStateReader != null) {
-      synchronized(this) {
-        if (zkStateReader!= null)
-          zkStateReader.close();
-        zkStateReader = null;
-      }
-    }
-    
-    if (shutdownLBHttpSolrServer) {
-      lbServer.shutdown();
-    }
-    
-    if (clientIsInternal && myClient!=null) {
-      myClient.getConnectionManager().shutdown();
-    }
-
-    if(this.threadPool != null && !this.threadPool.isShutdown()) {
-      this.threadPool.shutdown();
-    }
-  }
-
-  public LBHttpSolrServer getLbServer() {
-    return lbServer;
-  }
-  
-  public boolean isUpdatesToLeaders() {
-    return updatesToLeaders;
-  }
-
-  protected DocCollection getDocCollection(ClusterState clusterState, String collection) throws SolrException {
-    ExpiringCachedDocCollection cachedState = collectionStateCache != null ? collectionStateCache.get(collection) : null;
-    if (cachedState != null && cachedState.cached != null) {
-      return cachedState.cached;
-    }
-
-    DocCollection col = clusterState.getCollectionOrNull(collection);
-    if(col == null ) return  null;
-    if(col.getStateFormat() >1) collectionStateCache.put(collection, new ExpiringCachedDocCollection(col));
-    return col;
-  }
-
-
-  /**
-   * Useful for determining the minimum achieved replication factor across
-   * all shards involved in processing an update request, typically useful
-   * for gauging the replication factor of a batch. 
-   */
-  @SuppressWarnings("rawtypes")
-  public int getMinAchievedReplicationFactor(String collection, NamedList resp) {
-    // it's probably already on the top-level header set by condense
-    NamedList header = (NamedList)resp.get("responseHeader");
-    Integer achRf = (Integer)header.get(UpdateRequest.REPFACT);
-    if (achRf != null)
-      return achRf.intValue();
-
-    // not on the top-level header, walk the shard route tree
-    Map<String,Integer> shardRf = getShardReplicationFactor(collection, resp);
-    for (Integer rf : shardRf.values()) {
-      if (achRf == null || rf < achRf) {
-        achRf = rf;
-      }
-    }    
-    return (achRf != null) ? achRf.intValue() : -1;
-  }
-  
-  /**
-   * Walks the NamedList response after performing an update request looking for
-   * the replication factor that was achieved in each shard involved in the request.
-   * For single doc updates, there will be only one shard in the return value. 
-   */
-  @SuppressWarnings("rawtypes")
-  public Map<String,Integer> getShardReplicationFactor(String collection, NamedList resp) {
-    connect();
-    
-    Map<String,Integer> results = new HashMap<String,Integer>();
-    if (resp instanceof CloudSolrServer.RouteResponse) {
-      NamedList routes = ((CloudSolrServer.RouteResponse)resp).getRouteResponses();      
-      ClusterState clusterState = zkStateReader.getClusterState();     
-      Map<String,String> leaders = new HashMap<String,String>();
-      for (Slice slice : clusterState.getActiveSlices(collection)) {
-        Replica leader = slice.getLeader();
-        if (leader != null) {
-          ZkCoreNodeProps zkProps = new ZkCoreNodeProps(leader);
-          String leaderUrl = zkProps.getBaseUrl() + "/" + zkProps.getCoreName();
-          leaders.put(leaderUrl, slice.getName());
-          String altLeaderUrl = zkProps.getBaseUrl() + "/" + collection;
-          leaders.put(altLeaderUrl, slice.getName());
-        }
-      }
-      
-      Iterator<Map.Entry<String,Object>> routeIter = routes.iterator();
-      while (routeIter.hasNext()) {
-        Map.Entry<String,Object> next = routeIter.next();
-        String host = next.getKey();
-        NamedList hostResp = (NamedList)next.getValue();
-        Integer rf = (Integer)((NamedList)hostResp.get("responseHeader")).get(UpdateRequest.REPFACT);
-        if (rf != null) {
-          String shard = leaders.get(host);
-          if (shard == null) {
-            if (host.endsWith("/"))
-              shard = leaders.get(host.substring(0,host.length()-1));
-            if (shard == null) {
-              shard = host;
-            }
-          }
-          results.put(shard, rf);
-        }
-      }
-    }    
-    return results;
+  public CloudSolrServer(String zkHost, LBHttpSolrClient lbClient, boolean updatesToLeaders) {
+    super(zkHost, lbClient, updatesToLeaders);
   }
 }