Make sure 'http.keepAlive' defaults to true
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1421835 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1779158a4f
commit
c82a5116c2
|
@ -459,7 +459,7 @@ public class HttpClientBuilder {
|
||||||
poolingmgr.setDefaultConnectionConfig(defaultConnectionConfig);
|
poolingmgr.setDefaultConnectionConfig(defaultConnectionConfig);
|
||||||
}
|
}
|
||||||
if (systemProperties) {
|
if (systemProperties) {
|
||||||
String s = System.getProperty("http.keepAlive");
|
String s = System.getProperty("http.keepAlive", "true");
|
||||||
if ("true".equalsIgnoreCase(s)) {
|
if ("true".equalsIgnoreCase(s)) {
|
||||||
s = System.getProperty("http.maxConnections", "5");
|
s = System.getProperty("http.maxConnections", "5");
|
||||||
int max = Integer.parseInt(s);
|
int max = Integer.parseInt(s);
|
||||||
|
@ -479,7 +479,7 @@ public class HttpClientBuilder {
|
||||||
ConnectionReuseStrategy reuseStrategy = this.reuseStrategy;
|
ConnectionReuseStrategy reuseStrategy = this.reuseStrategy;
|
||||||
if (reuseStrategy == null) {
|
if (reuseStrategy == null) {
|
||||||
if (systemProperties) {
|
if (systemProperties) {
|
||||||
String s = System.getProperty("http.keepAlive");
|
String s = System.getProperty("http.keepAlive", "true");
|
||||||
if ("true".equalsIgnoreCase(s)) {
|
if ("true".equalsIgnoreCase(s)) {
|
||||||
reuseStrategy = DefaultConnectionReuseStrategy.INSTANCE;
|
reuseStrategy = DefaultConnectionReuseStrategy.INSTANCE;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -120,7 +120,7 @@ public class SystemDefaultHttpClient extends DefaultHttpClient {
|
||||||
protected ClientConnectionManager createClientConnectionManager() {
|
protected ClientConnectionManager createClientConnectionManager() {
|
||||||
PoolingClientConnectionManager connmgr = new PoolingClientConnectionManager(
|
PoolingClientConnectionManager connmgr = new PoolingClientConnectionManager(
|
||||||
SchemeRegistryFactory.createSystemDefault());
|
SchemeRegistryFactory.createSystemDefault());
|
||||||
String s = System.getProperty("http.keepAlive");
|
String s = System.getProperty("http.keepAlive", "true");
|
||||||
if ("true".equalsIgnoreCase(s)) {
|
if ("true".equalsIgnoreCase(s)) {
|
||||||
s = System.getProperty("http.maxConnections", "5");
|
s = System.getProperty("http.maxConnections", "5");
|
||||||
int max = Integer.parseInt(s);
|
int max = Integer.parseInt(s);
|
||||||
|
@ -138,7 +138,7 @@ public class SystemDefaultHttpClient extends DefaultHttpClient {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ConnectionReuseStrategy createConnectionReuseStrategy() {
|
protected ConnectionReuseStrategy createConnectionReuseStrategy() {
|
||||||
String s = System.getProperty("http.keepAlive");
|
String s = System.getProperty("http.keepAlive", "true");
|
||||||
if ("true".equalsIgnoreCase(s)) {
|
if ("true".equalsIgnoreCase(s)) {
|
||||||
return new DefaultConnectionReuseStrategy();
|
return new DefaultConnectionReuseStrategy();
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue