diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2012-11-06 17:08:53 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2012-11-06 17:08:53 +0000 |
commit | 3cc8ffe81e031b9c723b5b614720d036aca729ac (patch) | |
tree | 00530dc2e03e7d863cb0249291b75413f4e7b9d8 | |
parent | dea1131853d154b2e9276a911565bd73ac2e403d (diff) |
Set the default backoff strategy
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1406223 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/client/HttpClientFactory.java | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/client/HttpClientFactory.java b/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/client/HttpClientFactory.java index af61963e13..f09c7e9cc1 100644 --- a/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/client/HttpClientFactory.java +++ b/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/client/HttpClientFactory.java @@ -31,6 +31,7 @@ import org.apache.http.conn.ssl.SSLInitializationException; import org.apache.http.conn.ssl.SSLSocketFactory; import org.apache.http.impl.NoConnectionReuseStrategy; import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.http.impl.client.DefaultBackoffStrategy; import org.apache.http.impl.conn.PoolingClientConnectionManager; import org.apache.http.impl.conn.SchemeRegistryFactory; import org.apache.http.params.BasicHttpParams; @@ -129,6 +130,10 @@ public class HttpClientFactory implements LifeCycleListener { connectionManager.setMaxTotal(maxTotal); DefaultHttpClient client = new DefaultHttpClient(connectionManager, defaultParameters); + + // Set the default connection backoff + client.setConnectionBackoffStrategy(new DefaultBackoffStrategy()); + if (timeToLive <= 0) { client.setReuseStrategy(new NoConnectionReuseStrategy()); } |