lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markrmil...@apache.org
Subject svn commit: r1650608 [1/3] - in /lucene/dev/trunk/solr: ./ contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/ contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/ core/src/java/org/apache/solr/cloud/ core/src/java/...
Date Fri, 09 Jan 2015 17:33:05 GMT
Author: markrmiller
Date: Fri Jan  9 17:33:04 2015
New Revision: 1650608

URL: http://svn.apache.org/r1650608
Log:
SOLR-6932: All HttpClient ConnectionManagers and SolrJ clients should always be shutdown in tests and regular code.

Added:
    lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/common/util/IOUtils.java
      - copied, changed from r1650607, lucene/dev/trunk/solr/core/src/java/org/apache/solr/util/IOUtils.java
    lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/common/util/ObjectReleaseTracker.java   (with props)
Removed:
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/util/IOUtils.java
Modified:
    lucene/dev/trunk/solr/CHANGES.txt
    lucene/dev/trunk/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/SolrEntityProcessor.java
    lucene/dev/trunk/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestContentStreamDataSource.java
    lucene/dev/trunk/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestSolrEntityProcessorUnit.java
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/Overseer.java
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CoreContainer.java
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CoreDescriptor.java
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CorePropertiesLocator.java
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/HdfsDirectoryFactory.java
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/PluginInfo.java
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/SolrCore.java
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/SnapPuller.java
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/store/hdfs/HdfsDirectory.java
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/store/hdfs/HdfsLockFactory.java
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/HdfsUpdateLog.java
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/PeerSync.java
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/SolrIndexWriter.java
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/UpdateShardHandler.java
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/util/SolrCLI.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/AliasIntegrationTest.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIAsyncDistributedZkTest.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIDistributedZkTest.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/CustomCollectionTest.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/DeleteShardTest.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/LeaderFailoverAfterPartitionTest.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/LeaderInitiatedRecoveryOnCommitTest.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/MultiThreadedOCPTest.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/ShardSplitTest.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/SolrXmlInZkTest.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/TestLeaderElectionZkExpiry.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/TestRequestStatusCollectionAPI.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/ZkControllerTest.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestCoreDiscovery.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestDynamicLoading.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestImplicitCoreProperties.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestSolrConfigHandler.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/handler/TestBlobHandler.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/handler/TestConfigReload.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/handler/TestSolrConfigHandlerCloud.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/handler/TestSolrConfigHandlerConcurrent.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/rest/schema/TestBulkSchemaAPI.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/rest/schema/TestManagedSchemaDynamicFieldResource.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/rest/schema/TestManagedSchemaFieldResource.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/rest/schema/TestManagedSchemaFieldTypeResource.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/rest/schema/analysis/TestManagedStopFilterFactory.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/rest/schema/analysis/TestManagedSynonymFilterFactory.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/schema/TestBinaryField.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/schema/TestBulkSchemaConcurrent.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/schema/TestCloudManagedSchemaConcurrent.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/schema/TestCloudSchemaless.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/AnalyticsMergeStrategyTest.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/TestRecoveryHdfs.java
    lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java
    lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpClientConfigurer.java
    lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpClientUtil.java
    lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java
    lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrClient.java
    lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java
    lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExceptionTest.java
    lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/TestLBHttpSolrClient.java
    lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/impl/BasicHttpSolrClientTest.java
    lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientTest.java
    lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpClientUtilTest.java
    lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/impl/LBHttpSolrClientTest.java
    lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java
    lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/SolrJettyTestBase.java
    lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java
    lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java
    lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/cloud/ChaosMonkey.java
    lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/util/RestTestBase.java
    lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/util/RestTestHarness.java
    lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/util/SSLTestConfig.java

Modified: lucene/dev/trunk/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/CHANGES.txt?rev=1650608&r1=1650607&r2=1650608&view=diff
==============================================================================
--- lucene/dev/trunk/solr/CHANGES.txt (original)
+++ lucene/dev/trunk/solr/CHANGES.txt Fri Jan  9 17:33:04 2015
@@ -649,6 +649,9 @@ Other Changes
 * SOLR-6918: No need to log exceptions (as warn) generated when creating MBean stats if
   the core is shutting down (Timothy Potter)
 
+* SOLR-6932: All HttpClient ConnectionManagers and SolrJ clients should always be shutdown
+  in tests and regular code. (Mark Miller)
+
 ==================  4.10.3 ==================
 
 Bug Fixes

Modified: lucene/dev/trunk/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/SolrEntityProcessor.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/SolrEntityProcessor.java?rev=1650608&r1=1650607&r2=1650608&view=diff
==============================================================================
--- lucene/dev/trunk/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/SolrEntityProcessor.java (original)
+++ lucene/dev/trunk/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/SolrEntityProcessor.java Fri Jan  9 17:33:04 2015
@@ -17,9 +17,19 @@ package org.apache.solr.handler.dataimpo
  * limitations under the License.
  */
 
+import static org.apache.solr.handler.dataimport.DataImportHandlerException.SEVERE;
+import static org.apache.solr.handler.dataimport.DataImportHandlerException.wrapAndThrow;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
 import org.apache.http.client.HttpClient;
-import org.apache.solr.client.solrj.SolrQuery;
 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.HttpClientUtil;
 import org.apache.solr.client.solrj.impl.HttpSolrClient;
@@ -31,16 +41,6 @@ import org.apache.solr.common.params.Com
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import static org.apache.solr.handler.dataimport.DataImportHandlerException.SEVERE;
-import static org.apache.solr.handler.dataimport.DataImportHandlerException.wrapAndThrow;
-
 /**
  * <p>
  * An implementation of {@link EntityProcessor} which fetches values from a
@@ -71,6 +71,15 @@ public class SolrEntityProcessor extends
   private String[] fields;
   private String requestHandler;// 'qt' param
   private int timeout = TIMEOUT_SECS;
+  
+  @Override
+  public void destroy() {
+    try {
+      solrClient.shutdown();
+    } finally {
+      HttpClientUtil.close(((HttpSolrClient) solrClient).getHttpClient());
+    }
+  }
 
   /**
    * Factory method that returns a {@link HttpClient} instance used for interfacing with a source Solr service.
@@ -94,7 +103,6 @@ public class SolrEntityProcessor extends
             "SolrEntityProcessor: parameter 'url' is required");
       }
 
-      // TODO: we should close this client!
       HttpClient client = getHttpClient();
       URL url = new URL(serverPath);
       // (wt="javabin|xml") default is javabin

Modified: lucene/dev/trunk/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestContentStreamDataSource.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestContentStreamDataSource.java?rev=1650608&r1=1650607&r2=1650608&view=diff
==============================================================================
--- lucene/dev/trunk/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestContentStreamDataSource.java (original)
+++ lucene/dev/trunk/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestContentStreamDataSource.java Fri Jan  9 17:33:04 2015
@@ -67,17 +67,20 @@ public class TestContentStreamDataSource
     params.set("command", "full-import");
     params.set("clean", "false");
     req.setParams(params);
-    HttpSolrClient solrServer = new HttpSolrClient(buildUrl(jetty.getLocalPort(), "/solr"));
-    solrServer.request(req);
-    ModifiableSolrParams qparams = new ModifiableSolrParams();
-    qparams.add("q", "*:*");
-    QueryResponse qres = solrServer.query(qparams);
-    SolrDocumentList results = qres.getResults();
-    assertEquals(2, results.getNumFound());
-    SolrDocument doc = results.get(0);
-    assertEquals("1", doc.getFieldValue("id"));
-    assertEquals("Hello C1", ((List)doc.getFieldValue("desc")).get(0));
-    solrServer.shutdown();
+    HttpSolrClient solrClient = new HttpSolrClient(buildUrl(jetty.getLocalPort(), "/solr"));
+    try {
+      solrClient.request(req);
+      ModifiableSolrParams qparams = new ModifiableSolrParams();
+      qparams.add("q", "*:*");
+      QueryResponse qres = solrClient.query(qparams);
+      SolrDocumentList results = qres.getResults();
+      assertEquals(2, results.getNumFound());
+      SolrDocument doc = results.get(0);
+      assertEquals("1", doc.getFieldValue("id"));
+      assertEquals("Hello C1", ((List)doc.getFieldValue("desc")).get(0));
+    } finally {
+      solrClient.shutdown();
+    }
   }
 
   @Test

Modified: lucene/dev/trunk/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestSolrEntityProcessorUnit.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestSolrEntityProcessorUnit.java?rev=1650608&r1=1650607&r2=1650608&view=diff
==============================================================================
--- lucene/dev/trunk/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestSolrEntityProcessorUnit.java (original)
+++ lucene/dev/trunk/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestSolrEntityProcessorUnit.java Fri Jan  9 17:33:04 2015
@@ -32,9 +32,12 @@ public class TestSolrEntityProcessorUnit
     List<Doc> docs = generateUniqueDocs(2);
 
     MockSolrEntityProcessor processor = createAndInit(docs);
-
-    assertExpectedDocs(docs, processor);
-    assertEquals(1, processor.getQueryCount());
+    try {
+      assertExpectedDocs(docs, processor);
+      assertEquals(1, processor.getQueryCount());
+    } finally {
+      processor.destroy();
+    }
   }
 
   private MockSolrEntityProcessor createAndInit(List<Doc> docs) {
@@ -46,8 +49,12 @@ public class TestSolrEntityProcessorUnit
 
     int rowsNum = 10;
     MockSolrEntityProcessor processor = createAndInit(docs, rowsNum);
-    assertExpectedDocs(docs, processor);
-    assertEquals(5, processor.getQueryCount());
+    try {
+      assertExpectedDocs(docs, processor);
+      assertEquals(5, processor.getQueryCount());
+    } finally {
+      processor.destroy();
+    }
   }
 
   private MockSolrEntityProcessor createAndInit(List<Doc> docs, int rowsNum) {
@@ -67,15 +74,19 @@ public class TestSolrEntityProcessorUnit
     docs.add(testDoc);
 
     MockSolrEntityProcessor processor = createAndInit(docs);
-    Map<String, Object> next = processor.nextRow();
-    assertNotNull(next);
-
-    @SuppressWarnings("unchecked")
-    List<Comparable> multiField = (List<Comparable>) next.get("description");
-    assertEquals(testDoc.getValues("description").size(), multiField.size());
-    assertEquals(testDoc.getValues("description"), multiField);
-    assertEquals(1, processor.getQueryCount());
-    assertNull(processor.nextRow());
+    try {
+      Map<String, Object> next = processor.nextRow();
+      assertNotNull(next);
+  
+      @SuppressWarnings("unchecked")
+      List<Comparable> multiField = (List<Comparable>) next.get("description");
+      assertEquals(testDoc.getValues("description").size(), multiField.size());
+      assertEquals(testDoc.getValues("description"), multiField);
+      assertEquals(1, processor.getQueryCount());
+      assertNull(processor.nextRow());
+    } finally {
+      processor.destroy();
+    }
   }
 
   private List<Doc> generateUniqueDocs(int numDocs) {

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/Overseer.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/Overseer.java?rev=1650608&r1=1650607&r2=1650608&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/Overseer.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/Overseer.java Fri Jan  9 17:33:04 2015
@@ -58,7 +58,7 @@ import org.apache.solr.common.params.Col
 import org.apache.solr.core.ConfigSolr;
 import org.apache.solr.handler.component.ShardHandler;
 import org.apache.solr.update.UpdateShardHandler;
-import org.apache.solr.util.IOUtils;
+import org.apache.solr.common.util.IOUtils;
 import org.apache.solr.util.stats.Clock;
 import org.apache.solr.util.stats.Timer;
 import org.apache.solr.util.stats.TimerContext;

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CoreContainer.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CoreContainer.java?rev=1650608&r1=1650607&r2=1650608&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CoreContainer.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CoreContainer.java Fri Jan  9 17:33:04 2015
@@ -195,7 +195,12 @@ public class CoreContainer {
   public static CoreContainer createAndLoad(String solrHome, File configFile) {
     SolrResourceLoader loader = new SolrResourceLoader(solrHome);
     CoreContainer cc = new CoreContainer(loader, ConfigSolr.fromFile(loader, configFile));
-    cc.load();
+    try {
+      cc.load();
+    } catch (Exception e) {
+      cc.shutdown();
+      throw e;
+    }
     return cc;
   }
   
@@ -341,10 +346,9 @@ public class CoreContainer {
     }
 
     try {
-      coreAdminHandler.shutdown();
+      if (coreAdminHandler != null) coreAdminHandler.shutdown();
     } catch (Exception e) {
-      log.warn("Error shutting down CoreAdminHandler. Continuing to close CoreContainer.");
-      e.printStackTrace();
+      log.warn("Error shutting down CoreAdminHandler. Continuing to close CoreContainer.", e);
     }
 
     try {

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CoreDescriptor.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CoreDescriptor.java?rev=1650608&r1=1650607&r2=1650608&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CoreDescriptor.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CoreDescriptor.java Fri Jan  9 17:33:04 2015
@@ -23,7 +23,7 @@ import org.apache.commons.lang.StringUti
 import org.apache.solr.cloud.CloudDescriptor;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.params.SolrParams;
-import org.apache.solr.util.IOUtils;
+import org.apache.solr.common.util.IOUtils;
 import org.apache.solr.util.PropertiesUtil;
 
 import java.io.File;

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CorePropertiesLocator.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CorePropertiesLocator.java?rev=1650608&r1=1650607&r2=1650608&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CorePropertiesLocator.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CorePropertiesLocator.java Fri Jan  9 17:33:04 2015
@@ -18,8 +18,9 @@ package org.apache.solr.core;
  */
 
 import com.google.common.collect.Lists;
+
 import org.apache.solr.common.SolrException;
-import org.apache.solr.util.IOUtils;
+import org.apache.solr.common.util.IOUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/HdfsDirectoryFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/HdfsDirectoryFactory.java?rev=1650608&r1=1650607&r2=1650608&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/HdfsDirectoryFactory.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/HdfsDirectoryFactory.java Fri Jan  9 17:33:04 2015
@@ -38,6 +38,7 @@ import org.apache.solr.cloud.ZkControlle
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.SolrException.ErrorCode;
 import org.apache.solr.common.params.SolrParams;
+import org.apache.solr.common.util.IOUtils;
 import org.apache.solr.common.util.NamedList;
 import org.apache.solr.store.blockcache.BlockCache;
 import org.apache.solr.store.blockcache.BlockDirectory;
@@ -48,7 +49,6 @@ import org.apache.solr.store.blockcache.
 import org.apache.solr.store.hdfs.HdfsDirectory;
 import org.apache.solr.store.hdfs.HdfsLockFactory;
 import org.apache.solr.util.HdfsUtil;
-import org.apache.solr.util.IOUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/PluginInfo.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/PluginInfo.java?rev=1650608&r1=1650607&r2=1650608&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/PluginInfo.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/PluginInfo.java Fri Jan  9 17:33:04 2015
@@ -40,7 +40,7 @@ public class PluginInfo implements MapSe
   public final List<PluginInfo> children;
   private boolean isFromSolrConfig;
 
-  public PluginInfo(String type, Map<String, String> attrs ,NamedList initArgs, List<PluginInfo> children) {
+  public PluginInfo(String type, Map<String, String> attrs, NamedList initArgs, List<PluginInfo> children) {
     this.type = type;
     this.name = attrs.get(NAME);
     this.className = attrs.get(CLASS_NAME);

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/SolrCore.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/SolrCore.java?rev=1650608&r1=1650607&r2=1650608&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/SolrCore.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/SolrCore.java Fri Jan  9 17:33:04 2015
@@ -17,6 +17,47 @@
 
 package org.apache.solr.core;
 
+import java.io.Closeable;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.Writer;
+import java.lang.reflect.Constructor;
+import java.net.URL;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.NoSuchFileException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.IdentityHashMap;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.concurrent.locks.ReentrantLock;
+
+import javax.xml.parsers.ParserConfigurationException;
+
 import org.apache.commons.io.FileUtils;
 import org.apache.lucene.codecs.Codec;
 import org.apache.lucene.index.DirectoryReader;
@@ -38,6 +79,7 @@ import org.apache.solr.common.params.Com
 import org.apache.solr.common.params.CommonParams.EchoParamStyle;
 import org.apache.solr.common.params.SolrParams;
 import org.apache.solr.common.util.ExecutorUtil;
+import org.apache.solr.common.util.IOUtils;
 import org.apache.solr.common.util.NamedList;
 import org.apache.solr.common.util.SimpleOrderedMap;
 import org.apache.solr.core.DirectoryFactory.DirContext;
@@ -97,7 +139,6 @@ import org.apache.solr.update.processor.
 import org.apache.solr.update.processor.UpdateRequestProcessorChain;
 import org.apache.solr.update.processor.UpdateRequestProcessorFactory;
 import org.apache.solr.util.DefaultSolrThreadFactory;
-import org.apache.solr.util.IOUtils;
 import org.apache.solr.util.PropertiesInputStream;
 import org.apache.solr.util.RefCounted;
 import org.apache.solr.util.plugin.NamedListInitializedPlugin;
@@ -109,46 +150,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.xml.sax.SAXException;
 
-import javax.xml.parsers.ParserConfigurationException;
-import java.io.Closeable;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.Writer;
-import java.lang.reflect.Constructor;
-import java.net.URL;
-import java.nio.charset.StandardCharsets;
-import java.nio.file.NoSuchFileException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.IdentityHashMap;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import java.util.StringTokenizer;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.concurrent.locks.ReentrantLock;
-
 /**
  *
  */

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/SnapPuller.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/SnapPuller.java?rev=1650608&r1=1650607&r2=1650608&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/SnapPuller.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/SnapPuller.java Fri Jan  9 17:33:04 2015
@@ -16,42 +16,25 @@
  */
 package org.apache.solr.handler;
 
-import org.apache.commons.io.IOUtils;
-import org.apache.http.client.HttpClient;
-import org.apache.lucene.index.IndexCommit;
-import org.apache.lucene.index.IndexWriter;
-import org.apache.lucene.store.Directory;
-import org.apache.lucene.store.IOContext;
-import org.apache.lucene.store.IndexInput;
-import org.apache.lucene.store.IndexOutput;
-import org.apache.solr.client.solrj.SolrServerException;
-import org.apache.solr.client.solrj.impl.HttpClientUtil;
-import org.apache.solr.client.solrj.impl.HttpSolrClient;
-import org.apache.solr.client.solrj.request.QueryRequest;
-import org.apache.solr.common.SolrException;
-import org.apache.solr.common.SolrException.ErrorCode;
-import org.apache.solr.common.params.CommonParams;
-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.FastInputStream;
-import org.apache.solr.common.util.NamedList;
-import org.apache.solr.core.DirectoryFactory;
-import org.apache.solr.core.DirectoryFactory.DirContext;
-import org.apache.solr.core.IndexDeletionPolicyWrapper;
-import org.apache.solr.core.SolrCore;
-import org.apache.solr.handler.ReplicationHandler.FileInfo;
-import org.apache.solr.request.LocalSolrQueryRequest;
-import org.apache.solr.request.SolrQueryRequest;
-import org.apache.solr.search.SolrIndexSearcher;
-import org.apache.solr.update.CommitUpdateCommand;
-import org.apache.solr.util.DefaultSolrThreadFactory;
-import org.apache.solr.util.FileUtils;
-import org.apache.solr.util.PropertiesInputStream;
-import org.apache.solr.util.PropertiesOutputStream;
-import org.apache.solr.util.RefCounted;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import static org.apache.solr.handler.ReplicationHandler.ALIAS;
+import static org.apache.solr.handler.ReplicationHandler.CHECKSUM;
+import static org.apache.solr.handler.ReplicationHandler.CMD_DETAILS;
+import static org.apache.solr.handler.ReplicationHandler.CMD_GET_FILE;
+import static org.apache.solr.handler.ReplicationHandler.CMD_GET_FILE_LIST;
+import static org.apache.solr.handler.ReplicationHandler.CMD_INDEX_VERSION;
+import static org.apache.solr.handler.ReplicationHandler.COMMAND;
+import static org.apache.solr.handler.ReplicationHandler.COMPRESSION;
+import static org.apache.solr.handler.ReplicationHandler.CONF_FILES;
+import static org.apache.solr.handler.ReplicationHandler.CONF_FILE_SHORT;
+import static org.apache.solr.handler.ReplicationHandler.EXTERNAL;
+import static org.apache.solr.handler.ReplicationHandler.FILE;
+import static org.apache.solr.handler.ReplicationHandler.FILE_STREAM;
+import static org.apache.solr.handler.ReplicationHandler.GENERATION;
+import static org.apache.solr.handler.ReplicationHandler.INTERNAL;
+import static org.apache.solr.handler.ReplicationHandler.MASTER_URL;
+import static org.apache.solr.handler.ReplicationHandler.NAME;
+import static org.apache.solr.handler.ReplicationHandler.OFFSET;
+import static org.apache.solr.handler.ReplicationHandler.SIZE;
 
 import java.io.File;
 import java.io.FileNotFoundException;
@@ -91,25 +74,41 @@ import java.util.zip.Adler32;
 import java.util.zip.Checksum;
 import java.util.zip.InflaterInputStream;
 
-import static org.apache.solr.handler.ReplicationHandler.ALIAS;
-import static org.apache.solr.handler.ReplicationHandler.CHECKSUM;
-import static org.apache.solr.handler.ReplicationHandler.CMD_DETAILS;
-import static org.apache.solr.handler.ReplicationHandler.CMD_GET_FILE;
-import static org.apache.solr.handler.ReplicationHandler.CMD_GET_FILE_LIST;
-import static org.apache.solr.handler.ReplicationHandler.CMD_INDEX_VERSION;
-import static org.apache.solr.handler.ReplicationHandler.COMMAND;
-import static org.apache.solr.handler.ReplicationHandler.COMPRESSION;
-import static org.apache.solr.handler.ReplicationHandler.CONF_FILES;
-import static org.apache.solr.handler.ReplicationHandler.CONF_FILE_SHORT;
-import static org.apache.solr.handler.ReplicationHandler.EXTERNAL;
-import static org.apache.solr.handler.ReplicationHandler.FILE;
-import static org.apache.solr.handler.ReplicationHandler.FILE_STREAM;
-import static org.apache.solr.handler.ReplicationHandler.GENERATION;
-import static org.apache.solr.handler.ReplicationHandler.INTERNAL;
-import static org.apache.solr.handler.ReplicationHandler.MASTER_URL;
-import static org.apache.solr.handler.ReplicationHandler.NAME;
-import static org.apache.solr.handler.ReplicationHandler.OFFSET;
-import static org.apache.solr.handler.ReplicationHandler.SIZE;
+import org.apache.commons.io.IOUtils;
+import org.apache.http.client.HttpClient;
+import org.apache.lucene.index.IndexCommit;
+import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.store.Directory;
+import org.apache.lucene.store.IOContext;
+import org.apache.lucene.store.IndexInput;
+import org.apache.lucene.store.IndexOutput;
+import org.apache.solr.client.solrj.SolrServerException;
+import org.apache.solr.client.solrj.impl.HttpClientUtil;
+import org.apache.solr.client.solrj.impl.HttpSolrClient;
+import org.apache.solr.client.solrj.request.QueryRequest;
+import org.apache.solr.common.SolrException;
+import org.apache.solr.common.SolrException.ErrorCode;
+import org.apache.solr.common.params.CommonParams;
+import org.apache.solr.common.params.ModifiableSolrParams;
+import org.apache.solr.common.util.ExecutorUtil;
+import org.apache.solr.common.util.FastInputStream;
+import org.apache.solr.common.util.NamedList;
+import org.apache.solr.core.DirectoryFactory;
+import org.apache.solr.core.DirectoryFactory.DirContext;
+import org.apache.solr.core.IndexDeletionPolicyWrapper;
+import org.apache.solr.core.SolrCore;
+import org.apache.solr.handler.ReplicationHandler.FileInfo;
+import org.apache.solr.request.LocalSolrQueryRequest;
+import org.apache.solr.request.SolrQueryRequest;
+import org.apache.solr.search.SolrIndexSearcher;
+import org.apache.solr.update.CommitUpdateCommand;
+import org.apache.solr.util.DefaultSolrThreadFactory;
+import org.apache.solr.util.FileUtils;
+import org.apache.solr.util.PropertiesInputStream;
+import org.apache.solr.util.PropertiesOutputStream;
+import org.apache.solr.util.RefCounted;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * <p/> Provides functionality of downloading changed index files as well as config files and a timer for scheduling fetches from the
@@ -183,7 +182,6 @@ public class SnapPuller {
 
   public SnapPuller(final NamedList initArgs, final ReplicationHandler handler, final SolrCore sc) {
     solrCore = sc;
-    final SolrParams params = SolrParams.toSolrParams(initArgs);
     String masterUrl = (String) initArgs.get(MASTER_URL);
     if (masterUrl == null)
       throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java?rev=1650608&r1=1650607&r2=1650608&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java Fri Jan  9 17:33:04 2015
@@ -17,9 +17,37 @@
 
 package org.apache.solr.servlet;
 
+import java.io.ByteArrayInputStream;
+import java.io.EOFException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang.StringUtils;
-import org.apache.http.client.HttpClient;
+import org.apache.http.Header;
+import org.apache.http.HeaderIterator;
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpEntityEnclosingRequest;
+import org.apache.http.HttpResponse;
 import org.apache.http.client.methods.HttpDelete;
 import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
 import org.apache.http.client.methods.HttpGet;
@@ -28,13 +56,10 @@ import org.apache.http.client.methods.Ht
 import org.apache.http.client.methods.HttpPut;
 import org.apache.http.client.methods.HttpRequestBase;
 import org.apache.http.entity.InputStreamEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
 import org.apache.http.util.EntityUtils;
-import org.apache.http.Header;
-import org.apache.http.HeaderIterator;
-import org.apache.http.HttpEntity;
-import org.apache.http.HttpEntityEnclosingRequest;
-import org.apache.http.HttpResponse;
 import org.apache.solr.client.solrj.impl.CloudSolrClient;
+import org.apache.solr.client.solrj.impl.HttpClientUtil;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.SolrException.ErrorCode;
 import org.apache.solr.common.cloud.Aliases;
@@ -57,7 +82,6 @@ import org.apache.solr.core.CoreContaine
 import org.apache.solr.core.SolrConfig;
 import org.apache.solr.core.SolrCore;
 import org.apache.solr.core.SolrResourceLoader;
-import org.apache.solr.client.solrj.impl.HttpClientUtil;
 import org.apache.solr.handler.ContentStreamHandlerBase;
 import org.apache.solr.request.SolrQueryRequest;
 import org.apache.solr.request.SolrQueryRequestBase;
@@ -72,31 +96,6 @@ import org.apache.solr.update.processor.
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import java.io.ByteArrayInputStream;
-import java.io.EOFException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-
 /**
  * This filter looks at the incoming URL maps them to handlers defined in solrconfig.xml
  *
@@ -113,7 +112,7 @@ public class SolrDispatchFilter extends
 
   protected String pathPrefix = null; // strip this from the beginning of a path
   protected String abortErrorMessage = null;
-  protected final HttpClient httpClient = HttpClientUtil.createClient(new ModifiableSolrParams());
+  protected final CloseableHttpClient httpClient = HttpClientUtil.createClient(new ModifiableSolrParams());
   
   public SolrDispatchFilter() {
   }
@@ -190,10 +189,14 @@ public class SolrDispatchFilter extends
   
   @Override
   public void destroy() {
-    if (cores != null) {
-      cores.shutdown();
-      cores = null;
-    }    
+    try {
+      if (cores != null) {
+        cores.shutdown();
+        cores = null;
+      }
+    } finally {
+      IOUtils.closeQuietly(httpClient);
+    }
   }
   
   @Override
@@ -527,7 +530,6 @@ public class SolrDispatchFilter extends
       
       urlstr += queryString == null ? "" : "?" + queryString;
 
-      URL url = new URL(urlstr);
       boolean isPostOrPutRequest = "POST".equals(req.getMethod()) || "PUT".equals(req.getMethod());
 
       if ("GET".equals(req.getMethod())) {

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/store/hdfs/HdfsDirectory.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/store/hdfs/HdfsDirectory.java?rev=1650608&r1=1650607&r2=1650608&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/store/hdfs/HdfsDirectory.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/store/hdfs/HdfsDirectory.java Fri Jan  9 17:33:04 2015
@@ -85,11 +85,11 @@ public class HdfsDirectory extends BaseD
           }
           continue;
         }
-        org.apache.solr.util.IOUtils.closeQuietly(fileSystem);
+        org.apache.solr.common.util.IOUtils.closeQuietly(fileSystem);
         throw new RuntimeException(
             "Problem creating directory: " + hdfsDirPath, e);
       } catch (Exception e) {
-        org.apache.solr.util.IOUtils.closeQuietly(fileSystem);
+        org.apache.solr.common.util.IOUtils.closeQuietly(fileSystem);
         throw new RuntimeException(
             "Problem creating directory: " + hdfsDirPath, e);
       }

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/store/hdfs/HdfsLockFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/store/hdfs/HdfsLockFactory.java?rev=1650608&r1=1650607&r2=1650608&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/store/hdfs/HdfsLockFactory.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/store/hdfs/HdfsLockFactory.java Fri Jan  9 17:33:04 2015
@@ -29,7 +29,7 @@ import org.apache.lucene.store.Directory
 import org.apache.lucene.store.Lock;
 import org.apache.lucene.store.LockFactory;
 import org.apache.lucene.store.LockReleaseFailedException;
-import org.apache.solr.util.IOUtils;
+import org.apache.solr.common.util.IOUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/HdfsUpdateLog.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/HdfsUpdateLog.java?rev=1650608&r1=1650607&r2=1650608&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/HdfsUpdateLog.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/HdfsUpdateLog.java Fri Jan  9 17:33:04 2015
@@ -35,10 +35,10 @@ import org.apache.hadoop.ipc.RemoteExcep
 import org.apache.lucene.util.BytesRef;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.SolrException.ErrorCode;
+import org.apache.solr.common.util.IOUtils;
 import org.apache.solr.core.PluginInfo;
 import org.apache.solr.core.SolrCore;
 import org.apache.solr.util.HdfsUtil;
-import org.apache.solr.util.IOUtils;
 
 /** @lucene.experimental */
 public class HdfsUpdateLog extends UpdateLog {

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/PeerSync.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/PeerSync.java?rev=1650608&r1=1650607&r2=1650608&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/PeerSync.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/PeerSync.java Fri Jan  9 17:33:04 2015
@@ -296,20 +296,20 @@ public class PeerSync  {
         boolean connectTimeoutExceptionInChain = connectTimeoutExceptionInChain(srsp.getException());
         if (connectTimeoutExceptionInChain || solrException instanceof ConnectException || solrException instanceof ConnectTimeoutException
             || solrException instanceof NoHttpResponseException || solrException instanceof SocketException) {
-          log.warn(msg() + " couldn't connect to " + srsp.getShardAddress() + ", counting as success");
+          log.warn(msg() + " couldn't connect to " + srsp.getShardAddress() + ", counting as success", srsp.getException());
 
           return true;
         }
       }
       
       if (cantReachIsSuccess && sreq.purpose == 1 && srsp.getException() instanceof SolrException && ((SolrException) srsp.getException()).code() == 503) {
-        log.warn(msg() + " got a 503 from " + srsp.getShardAddress() + ", counting as success");
+        log.warn(msg() + " got a 503 from " + srsp.getShardAddress() + ", counting as success", srsp.getException());
         return true;
       }
       
       if (cantReachIsSuccess && sreq.purpose == 1 && srsp.getException() instanceof SolrException && ((SolrException) srsp.getException()).code() == 404) {
         log.warn(msg() + " got a 404 from " + srsp.getShardAddress() + ", counting as success. " +
-            "Perhaps /get is not registered?");
+            "Perhaps /get is not registered?", srsp.getException());
         return true;
       }
       

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/SolrIndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/SolrIndexWriter.java?rev=1650608&r1=1650607&r2=1650608&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/SolrIndexWriter.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/SolrIndexWriter.java Fri Jan  9 17:33:04 2015
@@ -26,10 +26,10 @@ import org.apache.lucene.index.IndexWrit
 import org.apache.lucene.index.IndexWriterConfig;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.util.InfoStream;
+import org.apache.solr.common.util.IOUtils;
 import org.apache.solr.core.DirectoryFactory;
 import org.apache.solr.core.DirectoryFactory.DirContext;
 import org.apache.solr.schema.IndexSchema;
-import org.apache.solr.util.IOUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/UpdateShardHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/UpdateShardHandler.java?rev=1650608&r1=1650607&r2=1650608&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/UpdateShardHandler.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/UpdateShardHandler.java Fri Jan  9 17:33:04 2015
@@ -22,12 +22,14 @@ import java.util.concurrent.Executors;
 
 import org.apache.http.client.HttpClient;
 import org.apache.http.conn.ClientConnectionManager;
+import org.apache.http.impl.client.CloseableHttpClient;
 import org.apache.http.impl.conn.PoolingClientConnectionManager;
 import org.apache.http.impl.conn.SchemeRegistryFactory;
 import org.apache.solr.client.solrj.impl.HttpClientUtil;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.params.ModifiableSolrParams;
 import org.apache.solr.common.util.ExecutorUtil;
+import org.apache.solr.common.util.IOUtils;
 import org.apache.solr.common.util.SolrjNamedThreadFactory;
 import org.apache.solr.core.ConfigSolr;
 import org.slf4j.Logger;
@@ -42,7 +44,7 @@ public class UpdateShardHandler {
   
   private PoolingClientConnectionManager clientConnectionManager;
   
-  private final HttpClient client;
+  private final CloseableHttpClient client;
 
   public UpdateShardHandler(ConfigSolr cfg) {
     
@@ -52,7 +54,6 @@ public class UpdateShardHandler {
       clientConnectionManager.setDefaultMaxPerRoute(cfg.getMaxUpdateConnectionsPerHost());
     }
     
-    
     ModifiableSolrParams params = new ModifiableSolrParams();
     if (cfg != null) {
       params.set(HttpClientUtil.PROP_SO_TIMEOUT,
@@ -84,6 +85,7 @@ public class UpdateShardHandler {
     } catch (Exception e) {
       SolrException.log(log, e);
     } finally {
+      IOUtils.closeQuietly(client);
       clientConnectionManager.shutdown();
     }
   }

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java?rev=1650608&r1=1650607&r2=1650608&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java Fri Jan  9 17:33:04 2015
@@ -784,7 +784,7 @@ public class DistributedUpdateProcessor
       } else {
         if (log.isWarnEnabled()) {
           for (Error error : errors) {
-            log.warn("Error sending update", error.e);
+            log.warn("Error sending update to " + error.req.node.getBaseUrl(), error.e);
           }
         }
       }

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/util/SolrCLI.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/util/SolrCLI.java?rev=1650608&r1=1650607&r2=1650608&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/util/SolrCLI.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/util/SolrCLI.java Fri Jan  9 17:33:04 2015
@@ -36,6 +36,7 @@ import org.apache.http.client.ResponseHa
 import org.apache.http.client.methods.HttpGet;
 import org.apache.http.client.utils.URIBuilder;
 import org.apache.http.conn.ConnectTimeoutException;
+import org.apache.http.impl.client.CloseableHttpClient;
 import org.apache.http.util.EntityUtils;
 import org.apache.log4j.Level;
 import org.apache.log4j.LogManager;
@@ -379,7 +380,7 @@ public class SolrCLI {
     return wasCommError;
   }
   
-  public static HttpClient getHttpClient() {
+  public static CloseableHttpClient getHttpClient() {
     ModifiableSolrParams params = new ModifiableSolrParams();
     params.set(HttpClientUtil.PROP_MAX_CONNECTIONS, 128);
     params.set(HttpClientUtil.PROP_MAX_CONNECTIONS_PER_HOST, 32);
@@ -388,10 +389,10 @@ public class SolrCLI {
   }
   
   @SuppressWarnings("deprecation")
-  public static void closeHttpClient(HttpClient httpClient) {
+  public static void closeHttpClient(CloseableHttpClient httpClient) {
     if (httpClient != null) {
       try {
-        httpClient.getConnectionManager().shutdown();
+        HttpClientUtil.close(httpClient);
       } catch (Exception exc) {
         // safe to ignore, we're just shutting things down
       }
@@ -403,7 +404,7 @@ public class SolrCLI {
    */
   public static Map<String,Object> getJson(String getUrl) throws Exception {
     Map<String,Object> json = null;
-    HttpClient httpClient = getHttpClient();
+    CloseableHttpClient httpClient = getHttpClient();
     try {
       json = getJson(httpClient, getUrl, 2);
     } finally {
@@ -595,7 +596,7 @@ public class SolrCLI {
 
       int exitCode = 0;
       String systemInfoUrl = solrUrl+"admin/info/system";
-      HttpClient httpClient = getHttpClient();
+      CloseableHttpClient httpClient = getHttpClient();
       try {
         // hit Solr to get system info
         Map<String,Object> systemInfo = getJson(httpClient, systemInfoUrl, 2);
@@ -1075,7 +1076,7 @@ public class SolrCLI {
           solrUrl += "/";
 
         String systemInfoUrl = solrUrl+"admin/info/system";
-        HttpClient httpClient = getHttpClient();
+        CloseableHttpClient httpClient = getHttpClient();
         try {
           // hit Solr to get system info
           Map<String,Object> systemInfo = getJson(httpClient, systemInfoUrl, 2);
@@ -1098,7 +1099,7 @@ public class SolrCLI {
           }
           zkHost = zookeeper;
         } finally {
-          closeHttpClient(httpClient);
+          HttpClientUtil.close(httpClient);
         }
       }
 
@@ -1319,7 +1320,7 @@ public class SolrCLI {
       String coreName = cli.getOptionValue("name");
 
       String systemInfoUrl = solrUrl+"admin/info/system";
-      HttpClient httpClient = getHttpClient();
+      CloseableHttpClient httpClient = getHttpClient();
       String solrHome = null;
       try {
         Map<String,Object> systemInfo = getJson(httpClient, systemInfoUrl, 2);

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/AliasIntegrationTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/AliasIntegrationTest.java?rev=1650608&r1=1650607&r2=1650608&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/AliasIntegrationTest.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/AliasIntegrationTest.java Fri Jan  9 17:33:04 2015
@@ -17,6 +17,10 @@ package org.apache.solr.cloud;
  * limitations under the License.
  */
 
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
 import org.apache.lucene.util.LuceneTestCase.Slow;
 import org.apache.solr.client.solrj.SolrClient;
 import org.apache.solr.client.solrj.SolrQuery;
@@ -38,10 +42,6 @@ import org.junit.AfterClass;
 import org.junit.Before;
 import org.junit.BeforeClass;
 
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
 /**
  * Test sync phase that occurs when Leader goes down and a new Leader is
  * elected.
@@ -179,7 +179,8 @@ public class AliasIntegrationTest extend
     client = new HttpSolrClient(buildUrl(port) + "/testalias");
     res = client.query(query);
     assertEquals(5, res.getResults().getNumFound());
-    
+    client.shutdown();
+    client = null;
     
     // now without collections param
     query = new SolrQuery("*:*");
@@ -213,26 +214,32 @@ public class AliasIntegrationTest extend
     // try a std client
     // search 1 and 2, but have no collections param
     query = new SolrQuery("*:*");
-    HttpSolrClient httpclient = new HttpSolrClient(getBaseUrl((HttpSolrClient) clients.get(0)) + "/testalias");
-    res = httpclient.query(query);
-    assertEquals(5, res.getResults().getNumFound());
-    httpclient.shutdown();
-    httpclient = null;
+    client = new HttpSolrClient(getBaseUrl((HttpSolrClient) clients.get(0)) + "/testalias");
+    try {
+      res = client.query(query);
+      assertEquals(5, res.getResults().getNumFound());
+    } finally {
+      client.shutdown();
+      client = null;
+    }
     
     createAlias("testalias", "collection2");
     
     // a second alias
     createAlias("testalias2", "collection2");
     
-    httpclient = new HttpSolrClient(getBaseUrl((HttpSolrClient) clients.get(0)) + "/testalias");
-    SolrInputDocument doc8 = getDoc(id, 11, i1, -600, tlong, 600, t1,
-        "humpty dumpy4 sat on a walls");
-    httpclient.add(doc8);
-    httpclient.commit();
-    res = httpclient.query(query);
-    assertEquals(3, res.getResults().getNumFound());
-    httpclient.shutdown();
-    httpclient = null;
+    client = new HttpSolrClient(getBaseUrl((HttpSolrClient) clients.get(0)) + "/testalias");
+    try {
+      SolrInputDocument doc8 = getDoc(id, 11, i1, -600, tlong, 600, t1,
+          "humpty dumpy4 sat on a walls");
+      client.add(doc8);
+      client.commit();
+      res = client.query(query);
+      assertEquals(3, res.getResults().getNumFound());
+    } finally {
+      client.shutdown();
+      client = null;
+    }
     
     createAlias("testalias", "collection2,collection1");
     
@@ -257,21 +264,24 @@ public class AliasIntegrationTest extend
       throws SolrServerException, IOException {
     SolrClient client = createNewSolrClient("",
         getBaseUrl((HttpSolrClient) clients.get(0)));
-    if (random().nextBoolean()) {
-      ModifiableSolrParams params = new ModifiableSolrParams();
-      params.set("collections", collections);
-      params.set("name", alias);
-      params.set("action", CollectionAction.CREATEALIAS.toString());
-      QueryRequest request = new QueryRequest(params);
-      request.setPath("/admin/collections");
-      client.request(request);
-    } else {
-      CreateAlias request = new CreateAlias();
-      request.setAliasName(alias);
-      request.setAliasedCollections(collections);
-      request.process(client);
+    try {
+      if (random().nextBoolean()) {
+        ModifiableSolrParams params = new ModifiableSolrParams();
+        params.set("collections", collections);
+        params.set("name", alias);
+        params.set("action", CollectionAction.CREATEALIAS.toString());
+        QueryRequest request = new QueryRequest(params);
+        request.setPath("/admin/collections");
+        client.request(request);
+      } else {
+        CreateAlias request = new CreateAlias();
+        request.setAliasName(alias);
+        request.setAliasedCollections(collections);
+        request.process(client);
+      }
+    } finally {
+      client.shutdown();
     }
-    client.shutdown();
   }
   
   private void deleteAlias(String alias) throws SolrServerException,

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java?rev=1650608&r1=1650607&r2=1650608&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java Fri Jan  9 17:33:04 2015
@@ -19,6 +19,7 @@ package org.apache.solr.cloud;
 
 import com.carrotsearch.randomizedtesting.annotations.ThreadLeakLingering;
 import org.apache.http.client.HttpClient;
+import org.apache.http.impl.client.CloseableHttpClient;
 import org.apache.lucene.util.LuceneTestCase.Slow;
 import org.apache.solr.SolrTestCaseJ4.SuppressSSL;
 import org.apache.solr.client.solrj.SolrClient;
@@ -29,6 +30,7 @@ import org.apache.solr.client.solrj.impl
 import org.apache.solr.client.solrj.impl.HttpSolrClient;
 import org.apache.solr.common.SolrInputDocument;
 import org.apache.solr.common.cloud.ZkStateReader;
+import org.apache.solr.common.util.IOUtils;
 import org.apache.solr.core.Diagnostics;
 import org.apache.solr.update.SolrCmdDistributor;
 import org.junit.After;
@@ -46,7 +48,7 @@ import java.util.Set;
 import java.util.concurrent.atomic.AtomicInteger;
 
 @Slow
-@SuppressSSL
+@SuppressSSL(bugUrl = "https://issues.apache.org/jira/browse/SOLR-5776")
 @ThreadLeakLingering(linger = 60000)
 public class ChaosMonkeyNothingIsSafeTest extends AbstractFullDistribZkTestBase {
   private static final int FAIL_TOLERANCE = 20;
@@ -290,7 +292,7 @@ public class ChaosMonkeyNothingIsSafeTes
   }
 
   class FullThrottleStopableIndexingThread extends StopableIndexingThread {
-    private HttpClient httpClient = HttpClientUtil.createClient(null);
+    private CloseableHttpClient httpClient = HttpClientUtil.createClient(null);
     private volatile boolean stop = false;
     int clientIndex = 0;
     private ConcurrentUpdateSolrClient cusc;
@@ -389,7 +391,7 @@ public class ChaosMonkeyNothingIsSafeTes
       stop = true;
       cusc.blockUntilFinished();
       cusc.shutdownNow();
-      httpClient.getConnectionManager().shutdown();
+      IOUtils.closeQuietly(httpClient);
     }
 
     @Override

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIAsyncDistributedZkTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIAsyncDistributedZkTest.java?rev=1650608&r1=1650607&r2=1650608&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIAsyncDistributedZkTest.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIAsyncDistributedZkTest.java Fri Jan  9 17:33:04 2015
@@ -70,48 +70,51 @@ public class CollectionsAPIAsyncDistribu
 
   private void testSolrJAPICalls() throws Exception {
     SolrClient client = createNewSolrClient("", getBaseUrl((HttpSolrClient) clients.get(0)));
-
-    Create createCollectionRequest = new Create();
-    createCollectionRequest.setCollectionName("testasynccollectioncreation");
-    createCollectionRequest.setNumShards(1);
-    createCollectionRequest.setConfigName("conf1");
-    createCollectionRequest.setAsyncId("1001");
-    createCollectionRequest.process(client);
-
-    String state = getRequestStateAfterCompletion("1001", MAX_TIMEOUT_SECONDS, client);
-
-    assertEquals("CreateCollection task did not complete!", "completed", state);
-
-
-    createCollectionRequest = new Create();
-    createCollectionRequest.setCollectionName("testasynccollectioncreation");
-    createCollectionRequest.setNumShards(1);
-    createCollectionRequest.setConfigName("conf1");
-    createCollectionRequest.setAsyncId("1002");
-    createCollectionRequest.process(client);
-
-    state = getRequestStateAfterCompletion("1002", MAX_TIMEOUT_SECONDS, client);
-
-    assertEquals("Recreating a collection with the same name didn't fail, should have.", "failed", state);
-
-    CollectionAdminRequest.AddReplica addReplica = new CollectionAdminRequest.AddReplica();
-    addReplica.setCollectionName("testasynccollectioncreation");
-    addReplica.setShardName("shard1");
-    addReplica.setAsyncId("1003");
-    client.request(addReplica);
-    state = getRequestStateAfterCompletion("1003", MAX_TIMEOUT_SECONDS, client);
-    assertEquals("Add replica did not complete", "completed", state);
-
-
-    SplitShard splitShardRequest = new SplitShard();
-    splitShardRequest.setCollectionName("testasynccollectioncreation");
-    splitShardRequest.setShardName("shard1");
-    splitShardRequest.setAsyncId("1004");
-    splitShardRequest.process(client);
-
-    state = getRequestStateAfterCompletion("1004", MAX_TIMEOUT_SECONDS * 2, client);
-
-    assertEquals("Shard split did not complete. Last recorded state: " + state, "completed", state);
+    try {
+      Create createCollectionRequest = new Create();
+      createCollectionRequest.setCollectionName("testasynccollectioncreation");
+      createCollectionRequest.setNumShards(1);
+      createCollectionRequest.setConfigName("conf1");
+      createCollectionRequest.setAsyncId("1001");
+      createCollectionRequest.process(client);
+  
+      String state = getRequestStateAfterCompletion("1001", MAX_TIMEOUT_SECONDS, client);
+  
+      assertEquals("CreateCollection task did not complete!", "completed", state);
+  
+  
+      createCollectionRequest = new Create();
+      createCollectionRequest.setCollectionName("testasynccollectioncreation");
+      createCollectionRequest.setNumShards(1);
+      createCollectionRequest.setConfigName("conf1");
+      createCollectionRequest.setAsyncId("1002");
+      createCollectionRequest.process(client);
+  
+      state = getRequestStateAfterCompletion("1002", MAX_TIMEOUT_SECONDS, client);
+  
+      assertEquals("Recreating a collection with the same name didn't fail, should have.", "failed", state);
+  
+      CollectionAdminRequest.AddReplica addReplica = new CollectionAdminRequest.AddReplica();
+      addReplica.setCollectionName("testasynccollectioncreation");
+      addReplica.setShardName("shard1");
+      addReplica.setAsyncId("1003");
+      client.request(addReplica);
+      state = getRequestStateAfterCompletion("1003", MAX_TIMEOUT_SECONDS, client);
+      assertEquals("Add replica did not complete", "completed", state);
+  
+  
+      SplitShard splitShardRequest = new SplitShard();
+      splitShardRequest.setCollectionName("testasynccollectioncreation");
+      splitShardRequest.setShardName("shard1");
+      splitShardRequest.setAsyncId("1004");
+      splitShardRequest.process(client);
+  
+      state = getRequestStateAfterCompletion("1004", MAX_TIMEOUT_SECONDS * 2, client);
+  
+      assertEquals("Shard split did not complete. Last recorded state: " + state, "completed", state);
+    } finally {
+      client.shutdown();
+    }
   }
 
   private String getRequestStateAfterCompletion(String requestId, int waitForSeconds, SolrClient client)

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIDistributedZkTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIDistributedZkTest.java?rev=1650608&r1=1650607&r2=1650608&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIDistributedZkTest.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIDistributedZkTest.java Fri Jan  9 17:33:04 2015
@@ -19,6 +19,7 @@ package org.apache.solr.cloud;
 
 import org.apache.lucene.util.LuceneTestCase.Slow;
 import org.apache.lucene.util.TestUtil;
+import org.apache.solr.client.solrj.SolrClient;
 import org.apache.solr.client.solrj.SolrQuery;
 import org.apache.solr.client.solrj.SolrRequest;
 import org.apache.solr.client.solrj.SolrServerException;
@@ -63,6 +64,7 @@ import org.junit.BeforeClass;
 import javax.management.MBeanServer;
 import javax.management.MBeanServerFactory;
 import javax.management.ObjectName;
+
 import java.io.File;
 import java.io.IOException;
 import java.lang.management.ManagementFactory;
@@ -231,8 +233,7 @@ public class CollectionsAPIDistributedZk
     QueryRequest request = new QueryRequest(params);
     request.setPath("/admin/collections");
     try {
-      NamedList<Object> resp = createNewSolrClient("", baseUrl)
-          .request(request);
+      makeRequest(baseUrl, request);
       fail("Expected to fail, because collection is not in clusterstate");
     } catch (RemoteSolrException e) {
       
@@ -256,7 +257,8 @@ public class CollectionsAPIDistributedZk
     if (secondConfigSet) {
       createCmd.setCollectionConfigName("conf1");
     }
-    createNewSolrClient("", baseUrl).request(createCmd);
+
+    makeRequest(baseUrl, createCmd);
 
     ModifiableSolrParams params = new ModifiableSolrParams();
     params.set("action", CollectionAction.DELETE.toString());
@@ -264,7 +266,7 @@ public class CollectionsAPIDistributedZk
     QueryRequest request = new QueryRequest(params);
     request.setPath("/admin/collections");
 
-    NamedList<Object> resp = createNewSolrClient("", baseUrl).request(request);
+    makeRequest(baseUrl, request);
     
     checkForMissingCollection(collectionName);
     
@@ -278,7 +280,7 @@ public class CollectionsAPIDistributedZk
     if (secondConfigSet) {
       params.set("collection.configName", "conf1");
     }
-    resp = createNewSolrClient("", baseUrl).request(request);
+    makeRequest(baseUrl, request);
   }
   
   
@@ -286,11 +288,21 @@ public class CollectionsAPIDistributedZk
     String baseUrl = getBaseUrl((HttpSolrClient) clients.get(0));
     // now try to remove a collection when a couple of its nodes are down
     if (secondConfigSet) {
-      createCollection(null, "halfdeletedcollection2", 3, 3, 6,
-          createNewSolrClient("", baseUrl), null, "conf2");
+      SolrClient client = createNewSolrClient("", baseUrl);
+      try {
+        createCollection(null, "halfdeletedcollection2", 3, 3, 6, client, null,
+            "conf2");
+      } finally {
+        client.shutdown();
+      }
     } else {
-      createCollection(null, "halfdeletedcollection2", 3, 3, 6,
-          createNewSolrClient("", baseUrl), null);
+      SolrClient client = createNewSolrClient("", baseUrl);
+      try {
+        createCollection(null, "halfdeletedcollection2", 3, 3, 6,
+          client, null);
+      } finally {
+        client.shutdown();
+      }
     }
     
     waitForRecoveriesToFinish("halfdeletedcollection2", false);
@@ -313,7 +325,7 @@ public class CollectionsAPIDistributedZk
     QueryRequest request = new QueryRequest(params);
     request.setPath("/admin/collections");
     
-    createNewSolrClient("", baseUrl).request(request);
+    makeRequest(baseUrl, request);
     
     long timeout = System.currentTimeMillis() + 10000;
     while (cloudClient.getZkStateReader().getClusterState().hasCollection("halfdeletedcollection2")) {
@@ -329,6 +341,16 @@ public class CollectionsAPIDistributedZk
 
   }
 
+  private NamedList<Object> makeRequest(String baseUrl, SolrRequest request)
+      throws SolrServerException, IOException {
+    SolrClient client = createNewSolrClient("", baseUrl);
+    try {
+      return client.request(request);
+    } finally {
+      client.shutdown();
+    }
+  }
+
   private void testErrorHandling() throws Exception {
     final String baseUrl = getBaseUrl((HttpSolrClient) clients.get(0));
     
@@ -342,9 +364,8 @@ public class CollectionsAPIDistributedZk
     QueryRequest request = new QueryRequest(params);
     request.setPath("/admin/collections");
     boolean gotExp = false;
-    NamedList<Object> resp = null;
     try {
-      resp = createNewSolrClient("", baseUrl).request(request);
+      makeRequest(baseUrl, request);
     } catch (SolrException e) {
       gotExp = true;
     }
@@ -364,9 +385,8 @@ public class CollectionsAPIDistributedZk
     request = new QueryRequest(params);
     request.setPath("/admin/collections");
     gotExp = false;
-    resp = null;
     try {
-      resp = createNewSolrClient("", baseUrl).request(request);
+      makeRequest(baseUrl, request);
     } catch (SolrException e) {
       gotExp = true;
     }
@@ -386,7 +406,7 @@ public class CollectionsAPIDistributedZk
     request.setPath("/admin/collections");
     gotExp = false;
     try {
-      resp = createNewSolrClient("", baseUrl).request(request);
+      makeRequest(baseUrl, request);
     } catch (SolrException e) {
       gotExp = true;
     }
@@ -404,9 +424,8 @@ public class CollectionsAPIDistributedZk
     request = new QueryRequest(params);
     request.setPath("/admin/collections");
     gotExp = false;
-    resp = null;
     try {
-      resp = createNewSolrClient("", baseUrl).request(request);
+      makeRequest(baseUrl, request);
     } catch (SolrException e) {
       gotExp = true;
     }
@@ -425,9 +444,8 @@ public class CollectionsAPIDistributedZk
     request = new QueryRequest(params);
     request.setPath("/admin/collections");
     gotExp = false;
-    resp = null;
     try {
-      resp = createNewSolrClient("", baseUrl).request(request);
+      makeRequest(baseUrl, request);
     } catch (SolrException e) {
       gotExp = true;
     }
@@ -446,7 +464,7 @@ public class CollectionsAPIDistributedZk
     if (secondConfigSet) {
       createCmd.setCollectionConfigName("conf1");
     }
-    createNewSolrClient("", baseUrl).request(createCmd);
+    makeRequest(baseUrl, createCmd);
     
     createCmd = new Create();
     createCmd.setCoreName("halfcollection_shard1_replica1");
@@ -457,7 +475,7 @@ public class CollectionsAPIDistributedZk
     if (secondConfigSet) {
       createCmd.setCollectionConfigName("conf1");
     }
-    createNewSolrClient("", getBaseUrl((HttpSolrClient) clients.get(1))).request(createCmd);
+    makeRequest(getBaseUrl((HttpSolrClient) clients.get(1)), createCmd);
     
     params = new ModifiableSolrParams();
     params.set("action", CollectionAction.CREATE.toString());
@@ -477,7 +495,7 @@ public class CollectionsAPIDistributedZk
     request = new QueryRequest(params);
     request.setPath("/admin/collections");
     gotExp = false;
-    resp = createNewSolrClient("", baseUrl).request(request);
+    NamedList<Object> resp = makeRequest(baseUrl, request);;
     
     SimpleOrderedMap success = (SimpleOrderedMap) resp.get("success");
     SimpleOrderedMap failure = (SimpleOrderedMap) resp.get("failure");
@@ -507,15 +525,13 @@ public class CollectionsAPIDistributedZk
       createCmd.setCollectionConfigName("conf1");
     }
     
-    createNewSolrClient("", getBaseUrl((HttpSolrClient) clients.get(1)))
-        .request(createCmd);
+    makeRequest(getBaseUrl((HttpSolrClient) clients.get(1)), createCmd);
     
     // try and create a SolrCore with no collection name
     createCmd.setCollection(null);
     createCmd.setCoreName("corewithnocollection2");
     
-    createNewSolrClient("", getBaseUrl((HttpSolrClient) clients.get(1)))
-        .request(createCmd);
+    makeRequest(getBaseUrl((HttpSolrClient) clients.get(1)), createCmd);
     
     // in both cases, the collection should have default to the core name
     cloudClient.getZkStateReader().updateClusterState(true);
@@ -542,7 +558,7 @@ public class CollectionsAPIDistributedZk
     
     QueryRequest request = new QueryRequest(params);
     request.setPath("/admin/collections");
-    createNewSolrClient("", baseUrl).request(request);
+    makeRequest(baseUrl, request);
     
     List<Integer> numShardsNumReplicaList = new ArrayList<>();
     numShardsNumReplicaList.add(2);
@@ -743,7 +759,7 @@ public class CollectionsAPIDistributedZk
     // we can use this client because we just want base url
     final String baseUrl = getBaseUrl((HttpSolrClient) clients.get(0));
     
-    createNewSolrClient("", baseUrl).request(request);
+    makeRequest(baseUrl, request);
 
     // reloads make take a short while
     boolean allTimesAreCorrect = waitForReloads(collectionName, urlToTimeBefore);
@@ -759,7 +775,7 @@ public class CollectionsAPIDistributedZk
     request = new QueryRequest(params);
     request.setPath("/admin/collections");
  
-    createNewSolrClient("", baseUrl).request(request);
+    makeRequest(baseUrl, request);
     
     // ensure its out of the state
     checkForMissingCollection(collectionName);
@@ -775,7 +791,7 @@ public class CollectionsAPIDistributedZk
  
     boolean exp = false;
     try {
-      createNewSolrClient("", baseUrl).request(request);
+      makeRequest(baseUrl, request);
     } catch (SolrException e) {
       exp = true;
     }
@@ -795,7 +811,7 @@ public class CollectionsAPIDistributedZk
     }
     request = new QueryRequest(params);
     request.setPath("/admin/collections");
-    createNewSolrClient("", baseUrl).request(request);
+    makeRequest(baseUrl, request);
     
     List<Integer> list = new ArrayList<>(2);
     list.add(1);



Mime
View raw message