Example usage for org.apache.http.impl.client IdleConnectionEvictor IdleConnectionEvictor

List of usage examples for org.apache.http.impl.client IdleConnectionEvictor IdleConnectionEvictor

Introduction

In this page you can find the example usage for org.apache.http.impl.client IdleConnectionEvictor IdleConnectionEvictor.

Prototype

public IdleConnectionEvictor(final HttpClientConnectionManager connectionManager,
            final ThreadFactory threadFactory, final long sleepTime, final TimeUnit sleepTimeUnit,
            final long maxIdleTime, final TimeUnit maxIdleTimeUnit) 

Source Link

Usage

From source file:com.github.parisoft.resty.client.Client.java

public static HttpClientConnectionManager getConnectionManager() {
    if (connectionManager == null) {
        synchronized (Client.class) {
            if (connectionManager == null) {
                connectionManager = new PoolingHttpClientConnectionManager();
                ((PoolingHttpClientConnectionManager) connectionManager).setMaxTotal(Integer.MAX_VALUE);
                ((PoolingHttpClientConnectionManager) connectionManager)
                        .setDefaultMaxPerRoute(Integer.MAX_VALUE);
                new IdleConnectionEvictor(connectionManager, null, 1, TimeUnit.MINUTES, 0, null).start();
            }//from   ww  w  . j av  a 2  s  .c  o  m
        }
    }

    return connectionManager;
}