Example usage for org.apache.commons.httpclient SimpleHttpConnectionManager closeIdleConnections

List of usage examples for org.apache.commons.httpclient SimpleHttpConnectionManager closeIdleConnections

Introduction

In this page you can find the example usage for org.apache.commons.httpclient SimpleHttpConnectionManager closeIdleConnections.

Prototype

public void closeIdleConnections(long paramLong) 

Source Link

Usage

From source file:cn.leancloud.diamond.client.processor.ServerAddressProcessor.java

private void initHttpClient() {
    HostConfiguration hostConfiguration = new HostConfiguration();

    SimpleHttpConnectionManager connectionManager = new SimpleHttpConnectionManager();
    connectionManager.closeIdleConnections(5000L);

    HttpConnectionManagerParams params = new HttpConnectionManagerParams();
    params.setStaleCheckingEnabled(diamondConfigure.isConnectionStaleCheckingEnabled());
    params.setConnectionTimeout(diamondConfigure.getConnectionTimeout());
    connectionManager.setParams(params);

    configHttpClient = new HttpClient(connectionManager);
    configHttpClient.setHostConfiguration(hostConfiguration);
}