Example usage for org.apache.http.impl.conn.tsccm ThreadSafeClientConnManager getMaxTotal

List of usage examples for org.apache.http.impl.conn.tsccm ThreadSafeClientConnManager getMaxTotal

Introduction

In this page you can find the example usage for org.apache.http.impl.conn.tsccm ThreadSafeClientConnManager getMaxTotal.

Prototype

public int getMaxTotal() 

Source Link

Document

since 4.1

Usage

From source file:org.sonatype.nexus.proxy.storage.remote.httpclient.HttpClientUtil.java

private static ThreadSafeClientConnManager createConnectionManager() {
    final ThreadSafeClientConnManager connManager = new ThreadSafeClientConnManager();

    int connectionPoolSize = SystemPropertiesHelper.getInteger(CONNECTION_POOL_SIZE_KEY, UNDEFINED_POOL_SIZE);
    if (connectionPoolSize != UNDEFINED_POOL_SIZE) {
        connManager.setMaxTotal(connectionPoolSize);
    }/*w  ww.jav  a 2s.c o m*/
    // NOTE: connPool is _per_ repo, hence all of those will connect to same host (unless mirrors are used)
    // so, we are violating intentionally the RFC and we let the whole pool size to chase same host
    connManager.setDefaultMaxPerRoute(connManager.getMaxTotal());

    return connManager;
}

From source file:org.eclipse.mylyn.commons.repositories.http.tests.HttpUtilTest.java

@Test
public void testConfigureConnectionManager() {
    ThreadSafeClientConnManager connManager = HttpUtil.getConnectionManager();

    assertEquals(CoreUtil.TEST_MODE ? 2 : MAX_HTTP_HOST_CONNECTIONS_DEFAULT,
            connManager.getDefaultMaxPerRoute());
    assertEquals(CoreUtil.TEST_MODE ? 20 : MAX_HTTP_TOTAL_CONNECTIONS_DEFAULT, connManager.getMaxTotal());
}

From source file:org.apache.abdera2.common.protocol.BasicClient.java

/**
 * Return the maximum number of connections allowed for the client
 *///from   w w  w.j  av  a2s .c  o  m
public int getMaxConnectionsTotal() {
    ClientConnectionManager ccm = client.getConnectionManager();
    if (ccm instanceof ThreadSafeClientConnManager) {
        ThreadSafeClientConnManager cm = (ThreadSafeClientConnManager) client.getConnectionManager();
        return cm.getMaxTotal();
    }
    return -1;
}