Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

specify timeout for connection manager as well

  • Loading branch information...
commit d35000827ca2535a65596ab028a4517c3b173d39 1 parent 6a88af2
@akkumar akkumar authored
View
5 src/java/voldemort/client/HttpStoreClientFactory.java
@@ -27,6 +27,7 @@
import org.apache.http.client.params.HttpClientParams;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.client.DefaultHttpRequestRetryHandler;
+import org.apache.http.impl.conn.SchemeRegistryFactory;
import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
import org.apache.http.params.CoreProtocolPNames;
import org.apache.http.params.HttpConnectionParams;
@@ -61,7 +62,9 @@
public HttpStoreClientFactory(ClientConfig config) {
super(config);
- ThreadSafeClientConnManager mgr = new ThreadSafeClientConnManager();
+ ThreadSafeClientConnManager mgr = new ThreadSafeClientConnManager(SchemeRegistryFactory.createDefault(),
+ config.getConnectionTimeout(TimeUnit.MILLISECONDS),
+ TimeUnit.MILLISECONDS);
mgr.setMaxTotal(config.getMaxTotalConnections());
mgr.setDefaultMaxPerRoute(config.getMaxConnectionsPerNode());
View
8 test/integration/voldemort/performance/HttpClientBench.java
@@ -16,6 +16,8 @@
package voldemort.performance;
+import java.util.concurrent.TimeUnit;
+
import org.apache.http.HttpResponse;
import org.apache.http.HttpVersion;
import org.apache.http.client.HttpClient;
@@ -24,6 +26,7 @@
import org.apache.http.client.params.HttpClientParams;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.client.DefaultHttpRequestRetryHandler;
+import org.apache.http.impl.conn.SchemeRegistryFactory;
import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
import org.apache.http.params.CoreConnectionPNames;
import org.apache.http.params.CoreProtocolPNames;
@@ -75,7 +78,10 @@ public void doOperation(int index) {
}
private static HttpClient createClient() {
- ThreadSafeClientConnManager connectionManager = new ThreadSafeClientConnManager();
+ ThreadSafeClientConnManager connectionManager = new ThreadSafeClientConnManager(SchemeRegistryFactory.createDefault(),
+ DEFAULT_CONNECTION_MANAGER_TIMEOUT,
+ TimeUnit.MILLISECONDS);
+
DefaultHttpClient httpClient = new DefaultHttpClient(connectionManager);
HttpParams clientParams = httpClient.getParams();
View
8 test/integration/voldemort/performance/RemoteStoreComparisonTest.java
@@ -16,11 +16,14 @@
package voldemort.performance;
+import java.util.concurrent.TimeUnit;
+
import org.apache.http.HttpVersion;
import org.apache.http.client.params.CookiePolicy;
import org.apache.http.client.params.HttpClientParams;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.client.DefaultHttpRequestRetryHandler;
+import org.apache.http.impl.conn.SchemeRegistryFactory;
import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
import org.apache.http.params.CoreProtocolPNames;
import org.apache.http.params.HttpConnectionParams;
@@ -155,7 +158,10 @@ public void doOperation(int i) {
8080);
httpService.start();
- ThreadSafeClientConnManager connectionManager = new ThreadSafeClientConnManager();
+ ThreadSafeClientConnManager connectionManager = new ThreadSafeClientConnManager(SchemeRegistryFactory.createDefault(),
+ 10000,
+ TimeUnit.MILLISECONDS);
+
DefaultHttpClient httpClient = new DefaultHttpClient(connectionManager);
HttpParams clientParams = httpClient.getParams();
View
7 test/unit/voldemort/store/http/HttpStoreTest.java
@@ -16,7 +16,10 @@
package voldemort.store.http;
+import java.util.concurrent.TimeUnit;
+
import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.impl.conn.SchemeRegistryFactory;
import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.params.HttpParams;
@@ -69,7 +72,9 @@ public void setUp() throws Exception {
ByteArray key = new ByteArray("test".getBytes());
RequestFormat requestFormat = new RequestFormatFactory().getRequestFormat(RequestFormatType.VOLDEMORT_V1);
- ThreadSafeClientConnManager connectionManager = new ThreadSafeClientConnManager();
+ ThreadSafeClientConnManager connectionManager = new ThreadSafeClientConnManager(SchemeRegistryFactory.createDefault(),
+ 5000,
+ TimeUnit.MILLISECONDS);
DefaultHttpClient client = new DefaultHttpClient(connectionManager);
HttpParams clientParams = client.getParams();
Please sign in to comment.
Something went wrong with that request. Please try again.