Example usage for org.apache.http.impl.conn PoolingClientConnectionManager PoolingClientConnectionManager

List of usage examples for org.apache.http.impl.conn PoolingClientConnectionManager PoolingClientConnectionManager

Introduction

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

Prototype

public PoolingClientConnectionManager() 

Source Link

Usage

From source file:guru.nidi.languager.check.LinkChecker.java

public LinkChecker(File file, List<MessageLine> contents, Logger logger) {
    this.file = file;
    this.contents = contents;
    this.logger = logger;

    final PoolingClientConnectionManager cm = new PoolingClientConnectionManager();
    cm.setMaxTotal(20);//from   ww w .j av a  2 s  .  co m
    this.client = new DefaultHttpClient(cm);
}

From source file:eu.earthobservatory.org.StrabonEndpoint.client.HTTPClient.java

public HTTPClient(String host, int port, String endpointName) {
    this.host = host;
    this.port = port;

    this.endpointName = (endpointName == null ? "" : endpointName);

    // create a connection manager for allowing the users of this class use threads
    connectionManager = new PoolingClientConnectionManager();

    // create an HttpClient instance that establishes connections based on the connection manager
    hc = new DefaultHttpClient(connectionManager);
}

From source file:org.fcrepo.federation.fedora3.itests.FedoraFederationIT.java

@BeforeClass
public static void ingestTestObjects() throws FedoraClientException, MalformedURLException {
    PoolingClientConnectionManager connectionManager = new PoolingClientConnectionManager();
    connectionManager.setMaxTotal(Integer.MAX_VALUE);
    connectionManager.setDefaultMaxPerRoute(5);
    connectionManager.closeIdleConnections(3, TimeUnit.SECONDS);
    client = new DefaultHttpClient(connectionManager);

    String fedoraUrl = "http://localhost:" + System.getProperty("servlet.port") + "/fedora";
    fc = new FedoraClient(new FedoraCredentials(fedoraUrl, "fedoraAdmin", "fc"));

    pid = "it:1";
    ingestFoxml(pid);/*from w  ww .  jav  a  2  s. com*/
    dsid = "SIMPLE_TEXT";

}

From source file:com.liferay.portal.search.solr.http.BasicAuthPoolingHttpClientFactory.java

@Override
protected PoolingClientConnectionManager createPoolingClientConnectionManager() {

    return new PoolingClientConnectionManager();
}

From source file:org.apache.stratos.integration.tests.rest.RestClient.java

public RestClient() {
    PoolingClientConnectionManager cm = new PoolingClientConnectionManager();
    // Increase max total connection to 200
    cm.setMaxTotal(200);/*from   w w w . ja  v  a  2s.  com*/
    // Increase default max connection per route to 50
    cm.setDefaultMaxPerRoute(50);

    httpClient = new DefaultHttpClient(cm);
    httpClient = (DefaultHttpClient) WebClientWrapper.wrapClient(httpClient);
}

From source file:com.teamlazerbeez.crm.sf.rest.RestConnectionPoolImpl.java

/**
 * Create a new pool with a specific idle connection timeout.
 *
 * @param idleConnTimeout how long an unused connection must sit idle before it is eligible for removal from the
 *                        pool, in seconds
 *///  ww w. ja  v  a 2  s  .c om
public RestConnectionPoolImpl(int idleConnTimeout) {
    // defaults are too low for these out of the box
    clientConnManager = new PoolingClientConnectionManager();
    clientConnManager.setDefaultMaxPerRoute(20);
    clientConnManager.setMaxTotal(60);

    this.httpClient = new DecompressingHttpClient(new DefaultHttpClient(clientConnManager, null));
    this.idleConnTimeout = idleConnTimeout;
}

From source file:io.sprucehill.mandrill.service.AbstractService.java

void onPostConstruct() {
    if (null == httpClient) {
        httpClient = new DefaultHttpClient(new PoolingClientConnectionManager());
    }/*from  w w w  .j  a v  a  2s.c om*/
    if (null == objectMapper) {
        objectMapper = new ObjectMapper();
    }
}

From source file:com.seyren.core.service.checker.GraphiteTargetChecker.java

private ClientConnectionManager createConnectionManager() {
    PoolingClientConnectionManager manager = new PoolingClientConnectionManager();
    manager.setDefaultMaxPerRoute(MAX_CONNECTIONS_PER_ROUTE);
    return manager;
}

From source file:com.lushapp.common.web.servlet.RemoteContentServlet.java

/**
 * HttpClient./*from  w  w  w . j ava  2 s. c  o  m*/
 */
@Override
public void init() throws ServletException {
    // Set connection pool
    PoolingClientConnectionManager cm = new PoolingClientConnectionManager();
    cm.setMaxTotal(CONNECTION_POOL_SIZE);
    httpClient = new DefaultHttpClient(cm);

    // set timeout
    HttpParams httpParams = httpClient.getParams();
    HttpConnectionParams.setSoTimeout(httpParams, TIMEOUT_SECONDS * 1000);
}

From source file:com.cprassoc.solr.auth.SolrHttpHandler.java

protected SolrHttpHandler() {
    PoolingClientConnectionManager cm = new PoolingClientConnectionManager();
    if (props == null) {
        props = SolrAuthManager.getProperties();
    }/*from   ww  w .  java2  s  . co  m*/

    if (props.getProperty("solr.ssl.enabled").equals("true")) {
        solrBaseUrl = "https://";
    } else {
        solrBaseUrl = "http://";
    }
    solrBaseUrl += props.getProperty("solr.host.port");
    //  solr.crawler.cloud.server=localhost:9983
    //admin:password123@
    CredentialsProvider provider = new BasicCredentialsProvider();

    UsernamePasswordCredentials credentials = new UsernamePasswordCredentials(
            props.getProperty("solr.admin.user"), props.getProperty("solr.admin.pwd"));
    provider.setCredentials(AuthScope.ANY, credentials);

    // client = new DefaultHttpClient(cm);
    client = HttpClientBuilder.create().setDefaultCredentialsProvider(provider).build();

    zkCloudClient = new CloudSolrClient(props.getProperty("solr.zookeeper.port"), client);
    zkCloudClient.setDefaultCollection(props.getProperty("solr.default.collection"));

    //     solrCloudClient = new CloudSolrClient(props.getProperty("solr.host.port"), client);
    //    solrCloudClient.setDefaultCollection(props.getProperty("solr.default.collection"));

    System.out.println("Solr Base URL: " + solrBaseUrl);
}