Examples of PoolingClientConnectionManager


Examples of org.apache.http.impl.conn.PoolingClientConnectionManager

    SchemeRegistry schemeRegistry = new SchemeRegistry();
    schemeRegistry.register(
             new Scheme("http", 80, PlainSocketFactory.getSocketFactory()));
    schemeRegistry.register(
             new Scheme("https", 443, SSLSocketFactory.getSocketFactory()));
    connectionManager = new PoolingClientConnectionManager(schemeRegistry);
    /*
     *
     *

CoreConnectionPNames.TCP_NODELAY='http.tcp.nodelay':  determines whether Nagle's algorithm is to be used. Nagle's algorithm tries to conserve bandwidth by minimizing the number of segments that are sent. When applications wish to decrease network latency and increase performance, they can disable Nagle's algorithm (that is enable TCP_NODELAY. Data will be sent earlier, at the cost of an increase in bandwidth consumption. This parameter expects a value of type java.lang.Boolean. If this parameter is not set, TCP_NODELAY will be enabled (no delay).
View Full Code Here

Examples of org.apache.http.impl.conn.PoolingClientConnectionManager

    SchemeRegistry schemeRegistry = new SchemeRegistry();
    schemeRegistry.register(
             new Scheme("http", 80, PlainSocketFactory.getSocketFactory()));
    schemeRegistry.register(
        new Scheme("https", 443, sf));
    connectionManager = new PoolingClientConnectionManager(schemeRegistry);
    // Increase max total connection to 200
    //cm.setMaxTotal(200);
    // Increase default max connection per route to 20
    //cm.setDefaultMaxPerRoute(20);
    // Increase max connections for localhost:80 to 50
View Full Code Here

Examples of org.apache.http.impl.conn.PoolingClientConnectionManager

    */
    @Inject
    public DefaultHttpTransportService(ThreadPoolService threadPoolService, Settings settings) {
        this.threadPoolService = threadPoolService;
        this.settings = settings;
        PoolingClientConnectionManager poolingClientConnectionManager = new PoolingClientConnectionManager();
        poolingClientConnectionManager.setMaxTotal(settings.getAsInt("http.client.max_total", 100));
        poolingClientConnectionManager.setDefaultMaxPerRoute(settings.getAsInt("http.client.default_max_per_route", 50));
        final HttpParams httpParams = new BasicHttpParams();
        HttpConnectionParams.setConnectionTimeout(httpParams, settings.getAsInt("http.client.connect.timeout", 5000));
        HttpConnectionParams.setSoTimeout(httpParams, settings.getAsInt("http.client.accept.timeout", 5000));
        httpClient = new DefaultHttpClient(poolingClientConnectionManager, httpParams);
    }
View Full Code Here

Examples of org.apache.http.impl.conn.PoolingClientConnectionManager

  }
  /**
   * Construct a sitestream controller using a DefaultHttpClient
   */
  public SitestreamController(Hosts hosts, Authentication auth) {
    this.client = new DefaultHttpClient(new PoolingClientConnectionManager());
    this.hosts = Preconditions.checkNotNull(hosts);
    this.auth = Preconditions.checkNotNull(auth);
  }
View Full Code Here

Examples of org.apache.http.impl.conn.PoolingClientConnectionManager

  /**
   * Construct a sitestream controller using the default host (sitestream.twitter.com) and a
   * DefaultHttpClient.
   */
  public SitestreamController(Authentication auth) {
    this.client = new DefaultHttpClient(new PoolingClientConnectionManager());
    this.hosts = new HttpHosts(Constants.SITESTREAM_HOST);
    this.auth = Preconditions.checkNotNull(auth);
  }
View Full Code Here

Examples of org.apache.http.impl.conn.PoolingClientConnectionManager

    this.underlying = new AtomicReference<HttpClient>();
  }

  public void setup() {
    DefaultHttpClient defaultClient = new DefaultHttpClient(new PoolingClientConnectionManager(schemeRegistry), params);

    auth.setupConnection(defaultClient);

    if (enableGZip) {
      underlying.set(new DecompressingHttpClient(defaultClient));
View Full Code Here

Examples of org.apache.http.impl.conn.PoolingClientConnectionManager

    Preconditions.checkNotNull(auth);
    HttpClient client;
    if (enableGZip) {
      client = new RestartableHttpClient(auth, enableGZip, params, schemeRegistry);
    } else {
      DefaultHttpClient defaultClient = new DefaultHttpClient(new PoolingClientConnectionManager(schemeRegistry), params);

      /** Set auth **/
      auth.setupConnection(defaultClient);
      client = defaultClient;
    }
View Full Code Here

Examples of org.apache.http.impl.conn.PoolingClientConnectionManager

    return httpClient;
  }

  protected ClientConnectionManager buildConnectionManager(SchemeRegistry schemeRegistry) {
    return new PoolingClientConnectionManager(schemeRegistry);
  }
View Full Code Here

Examples of org.apache.http.impl.conn.PoolingClientConnectionManager

    }

    SchemeRegistry schemeRegistry = new SchemeRegistry();
    schemeRegistry.register(new Scheme("https", port, schemeSocketFactory));

    PoolingClientConnectionManager connectionManager = new PoolingClientConnectionManager(schemeRegistry);

    HttpClient httpClient = new DefaultHttpClient(connectionManager);

    httpClient = new DecompressingHttpClient(httpClient);
View Full Code Here

Examples of org.apache.http.impl.conn.PoolingClientConnectionManager

    /**
     * Connection manager to allow concurrent connections.
     * @return {@link ClientConnectionManager} instance
     */
    public static ClientConnectionManager getConnectionManager() {
  PoolingClientConnectionManager connManager =
    new PoolingClientConnectionManager( SchemeRegistryFactory.createDefault());
  connManager.setMaxTotal(100);
  connManager.setDefaultMaxPerRoute(30);
  return connManager;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.