diff --git a/dev-tools/maven/pom.xml.template b/dev-tools/maven/pom.xml.template
index 58ffb12f869..5742a30fd52 100644
--- a/dev-tools/maven/pom.xml.template
+++ b/dev-tools/maven/pom.xml.template
@@ -48,7 +48,7 @@
8.1.8.v20121106
1.6.4
1.2
- 4.1.3
+ 4.2.3
1
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index bacb8080a8c..63f70cab766 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -71,6 +71,10 @@ New Features
* SOLR-4370: Allow configuring commitWithin to do hard commits.
(Mark Miller, Senthuran Sivananthan)
+* SOLR-4451: SolrJ, and SolrCloud internals, now use SystemDefaultHttpClient
+ under the covers -- allowing many HTTP connection related properties to be
+ controlled via 'standard' java system properties. (hossman)
+
Bug Fixes
----------------------
diff --git a/solr/licenses/httpclient-4.1.3.jar.sha1 b/solr/licenses/httpclient-4.1.3.jar.sha1
deleted file mode 100644
index a13fbc59529..00000000000
--- a/solr/licenses/httpclient-4.1.3.jar.sha1
+++ /dev/null
@@ -1 +0,0 @@
-16cf5a6b78951f50713d29bfae3230a611dc01f0
diff --git a/solr/licenses/httpclient-4.2.3.jar.sha1 b/solr/licenses/httpclient-4.2.3.jar.sha1
new file mode 100644
index 00000000000..b7371916b97
--- /dev/null
+++ b/solr/licenses/httpclient-4.2.3.jar.sha1
@@ -0,0 +1 @@
+37ced84d839a02fb856255eca85f0a4be95aa634
diff --git a/solr/licenses/httpcore-4.1.4.jar.sha1 b/solr/licenses/httpcore-4.1.4.jar.sha1
deleted file mode 100644
index 5ca14f20e02..00000000000
--- a/solr/licenses/httpcore-4.1.4.jar.sha1
+++ /dev/null
@@ -1 +0,0 @@
-31cc0a151d458c4b99476805ede9c8accafb734c
diff --git a/solr/licenses/httpcore-4.2.3.jar.sha1 b/solr/licenses/httpcore-4.2.3.jar.sha1
new file mode 100644
index 00000000000..fb16a02172b
--- /dev/null
+++ b/solr/licenses/httpcore-4.2.3.jar.sha1
@@ -0,0 +1 @@
+5e92ec56abe188b865642a14e1a037c1253fc42e
diff --git a/solr/licenses/httpmime-4.1.3.jar.sha1 b/solr/licenses/httpmime-4.1.3.jar.sha1
deleted file mode 100644
index 6e55c543ff9..00000000000
--- a/solr/licenses/httpmime-4.1.3.jar.sha1
+++ /dev/null
@@ -1 +0,0 @@
-d97e400d31bbeb36c1c60d2c3a9bbf2cdccf85a8
diff --git a/solr/licenses/httpmime-4.2.3.jar.sha1 b/solr/licenses/httpmime-4.2.3.jar.sha1
new file mode 100644
index 00000000000..b571384270a
--- /dev/null
+++ b/solr/licenses/httpmime-4.2.3.jar.sha1
@@ -0,0 +1 @@
+118ae1bc7f3aeeddfe564f0edfd79c11d09d17d1
diff --git a/solr/solrj/ivy.xml b/solr/solrj/ivy.xml
index 1305d2d0bd6..17599b82616 100644
--- a/solr/solrj/ivy.xml
+++ b/solr/solrj/ivy.xml
@@ -21,9 +21,9 @@
-
-
-
+
+
+
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrServer.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrServer.java
index 75519267874..d860ecd2cb9 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrServer.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrServer.java
@@ -79,8 +79,7 @@ public class ConcurrentUpdateSolrServer extends SolrServer {
final int threadCount;
/**
- * Uses an internal ThreadSafeClientConnManager to manage http
- * connections.
+ * Uses an internaly managed HttpClient instance.
*
* @param solrServerUrl
* The Solr server URL
@@ -95,9 +94,7 @@ public class ConcurrentUpdateSolrServer extends SolrServer {
}
/**
- * Uses the supplied HttpClient to send documents to the Solr server, the
- * HttpClient should be instantiated using a
- * ThreadSafeClientConnManager.
+ * Uses the supplied HttpClient to send documents to the Solr server.
*/
public ConcurrentUpdateSolrServer(String solrServerUrl,
HttpClient client, int queueSize, int threadCount) {
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpClientUtil.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpClientUtil.java
index cc78279d68b..38873025d32 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpClientUtil.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpClientUtil.java
@@ -35,8 +35,10 @@ import org.apache.http.client.HttpClient;
import org.apache.http.client.params.ClientParamBean;
import org.apache.http.entity.HttpEntityWrapper;
import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.impl.client.SystemDefaultHttpClient;
import org.apache.http.impl.client.DefaultHttpRequestRetryHandler;
-import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
+import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager; // jdoc
+import org.apache.http.impl.conn.PoolingClientConnectionManager;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.protocol.HttpContext;
import org.apache.solr.common.params.ModifiableSolrParams;
@@ -94,14 +96,12 @@ public class HttpClientUtil {
*
* @param params
* http client configuration, if null a client with default
- * configuration (no additional configuration) is created that uses
- * ThreadSafeClientConnManager.
+ * configuration (no additional configuration) is created.
*/
public static HttpClient createClient(final SolrParams params) {
final ModifiableSolrParams config = new ModifiableSolrParams(params);
logger.info("Creating new http client, config:" + config);
- final ThreadSafeClientConnManager mgr = new ThreadSafeClientConnManager();
- final DefaultHttpClient httpClient = new DefaultHttpClient(mgr);
+ final DefaultHttpClient httpClient = new SystemDefaultHttpClient();
configureClient(httpClient, config);
return httpClient;
}
@@ -153,25 +153,35 @@ public class HttpClientUtil {
/**
* Set max connections allowed per host. This call will only work when
- * {@link ThreadSafeClientConnManager} is used.
+ * {@link ThreadSafeClientConnManager} or
+ * {@link PoolingClientConnectionManager} is used.
*/
public static void setMaxConnectionsPerHost(HttpClient httpClient,
int max) {
- if(httpClient.getConnectionManager() instanceof ThreadSafeClientConnManager) {
+ // would have been nice if there was a common interface
+ if (httpClient.getConnectionManager() instanceof ThreadSafeClientConnManager) {
ThreadSafeClientConnManager mgr = (ThreadSafeClientConnManager)httpClient.getConnectionManager();
mgr.setDefaultMaxPerRoute(max);
+ } else if (httpClient.getConnectionManager() instanceof PoolingClientConnectionManager) {
+ PoolingClientConnectionManager mgr = (PoolingClientConnectionManager)httpClient.getConnectionManager();
+ mgr.setDefaultMaxPerRoute(max);
}
}
/**
* Set max total connections allowed. This call will only work when
- * {@link ThreadSafeClientConnManager} is used.
+ * {@link ThreadSafeClientConnManager} or
+ * {@link PoolingClientConnectionManager} is used.
*/
public static void setMaxConnections(final HttpClient httpClient,
int max) {
- if(httpClient.getConnectionManager() instanceof ThreadSafeClientConnManager) {
+ // would have been nice if there was a common interface
+ if (httpClient.getConnectionManager() instanceof ThreadSafeClientConnManager) {
ThreadSafeClientConnManager mgr = (ThreadSafeClientConnManager)httpClient.getConnectionManager();
mgr.setMaxTotal(max);
+ } else if (httpClient.getConnectionManager() instanceof PoolingClientConnectionManager) {
+ PoolingClientConnectionManager mgr = (PoolingClientConnectionManager)httpClient.getConnectionManager();
+ mgr.setMaxTotal(max);
}
}
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpClientUtilTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpClientUtilTest.java
index 6d136c1a57e..44faa96da98 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpClientUtilTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpClientUtilTest.java
@@ -23,8 +23,8 @@ import java.util.concurrent.atomic.AtomicInteger;
import org.apache.http.auth.AuthScope;
import org.apache.http.client.HttpClient;
import org.apache.http.client.params.ClientPNames;
+import org.apache.http.impl.conn.PoolingClientConnectionManager;
import org.apache.http.impl.client.DefaultHttpClient;
-import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
import org.apache.http.params.HttpConnectionParams;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.params.SolrParams;
@@ -52,9 +52,9 @@ public class HttpClientUtilTest {
params.set(HttpClientUtil.PROP_USE_RETRY, false);
DefaultHttpClient client = (DefaultHttpClient) HttpClientUtil.createClient(params);
assertEquals(12345, HttpConnectionParams.getConnectionTimeout(client.getParams()));
- assertEquals(ThreadSafeClientConnManager.class, client.getConnectionManager().getClass());
- assertEquals(22345, ((ThreadSafeClientConnManager)client.getConnectionManager()).getMaxTotal());
- assertEquals(32345, ((ThreadSafeClientConnManager)client.getConnectionManager()).getDefaultMaxPerRoute());
+ assertEquals(PoolingClientConnectionManager.class, client.getConnectionManager().getClass());
+ assertEquals(22345, ((PoolingClientConnectionManager)client.getConnectionManager()).getMaxTotal());
+ assertEquals(32345, ((PoolingClientConnectionManager)client.getConnectionManager()).getDefaultMaxPerRoute());
assertEquals(42345, HttpConnectionParams.getSoTimeout(client.getParams()));
assertEquals(HttpClientUtil.NO_RETRY, client.getHttpRequestRetryHandler());
assertEquals("pass", client.getCredentialsProvider().getCredentials(new AuthScope("127.0.0.1", 1234)).getPassword());
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/LBHttpSolrServerTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/LBHttpSolrServerTest.java
index fd166c6ce53..b1b1fa7cca1 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/LBHttpSolrServerTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/LBHttpSolrServerTest.java
@@ -7,7 +7,6 @@ import static org.junit.Assert.*;
import java.net.MalformedURLException;
-import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.solr.client.solrj.ResponseParser;
import org.junit.Test;
@@ -28,6 +27,8 @@ import org.junit.Test;
* limitations under the License.
*/
+import org.apache.solr.common.params.ModifiableSolrParams;
+
/**
* Test the LBHttpSolrServer.
*/
@@ -42,14 +43,14 @@ public class LBHttpSolrServerTest {
*/
@Test
public void testLBHttpSolrServerHttpClientResponseParserStringArray() throws MalformedURLException {
- LBHttpSolrServer testServer = new LBHttpSolrServer(new DefaultHttpClient(), (ResponseParser) null);
+ LBHttpSolrServer testServer = new LBHttpSolrServer(HttpClientUtil.createClient(new ModifiableSolrParams()), (ResponseParser) null);
HttpSolrServer httpServer = testServer.makeServer("http://127.0.0.1:8080");
assertNull("Generated server should have null parser.", httpServer.getParser());
ResponseParser parser = new BinaryResponseParser();
- testServer = new LBHttpSolrServer(new DefaultHttpClient(), parser);
+ testServer = new LBHttpSolrServer(HttpClientUtil.createClient(new ModifiableSolrParams()), parser);
httpServer = testServer.makeServer("http://127.0.0.1:8080");
assertEquals("Invalid parser passed to generated server.", parser, httpServer.getParser());
}
-}
\ No newline at end of file
+}