Package org.apache.http.conn.params

Examples of org.apache.http.conn.params.ConnPerRouteBean


  public Subscriber(Web webserver) {
   
    this.webserver = webserver;
    HttpParams params = new BasicHttpParams();
    ConnManagerParams.setMaxTotalConnections(params, 200);
    ConnPerRouteBean connPerRoute = new ConnPerRouteBean(20);
    connPerRoute.setDefaultMaxPerRoute(50);
    ConnManagerParams.setMaxConnectionsPerRoute(params, connPerRoute);

    SchemeRegistry schemeRegistry = new SchemeRegistry();
    schemeRegistry.register(new Scheme("http", PlainSocketFactory
        .getSocketFactory(), 80));
View Full Code Here


    public HttpClient createHttpClient() {
        HttpParams defaultParameters = new BasicHttpParams();
        //defaultParameters.setIntParameter(HttpConnectionManagerParams.MAX_TOTAL_CONNECTIONS, 10);

        ConnManagerParams.setMaxTotalConnections(defaultParameters, 1024);
        ConnPerRoute connPerRoute = new ConnPerRouteBean(256);
        ConnManagerParams.setMaxConnectionsPerRoute(defaultParameters, connPerRoute);

        HttpProtocolParams.setContentCharset(defaultParameters, HTTP.UTF_8);
        HttpConnectionParams.setConnectionTimeout(defaultParameters, 60000);
        HttpConnectionParams.setSoTimeout(defaultParameters, 60000);
View Full Code Here

        schemeRegistry.register( new Scheme( "https", new EasySSLSocketFactory(), 443 ) );

        HttpParams params = new BasicHttpParams();
        // TODO put this values to a configuration way ???
        params.setParameter( ConnManagerPNames.MAX_TOTAL_CONNECTIONS, new Integer( 30 ) );
        params.setParameter( ConnManagerPNames.MAX_CONNECTIONS_PER_ROUTE, new ConnPerRouteBean( 30 ) );
        HttpProtocolParams.setVersion( params, HttpVersion.HTTP_1_1 );

        ClientConnectionManager cm = new ThreadSafeClientConnManager( params, schemeRegistry );

        httpClient = new DefaultHttpClient( cm, params );
View Full Code Here

        retryThread.setDaemon(true);
        retryThread.start();

        HttpParams params = new BasicHttpParams();
        ConnManagerParams.setMaxTotalConnections(params, maxThreads);
        ConnPerRouteBean connPerRoute = new ConnPerRouteBean(maxThreads);
        ConnManagerParams.setMaxConnectionsPerRoute(params, connPerRoute);

        // set 15 second timeouts, since Loggly should return quickly
        params.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 15000);
        params.setIntParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, 15000);
View Full Code Here

        SchemeRegistry schemeRegistry = new SchemeRegistry();
        schemeRegistry.register( new Scheme( "http", PlainSocketFactory.getSocketFactory(), 80 ) );

        HttpParams params = new BasicHttpParams();
        params.setParameter( ConnManagerPNames.MAX_TOTAL_CONNECTIONS, 30 );
        params.setParameter( ConnManagerPNames.MAX_CONNECTIONS_PER_ROUTE, new ConnPerRouteBean( 30 ) );

        HttpProtocolParams.setVersion( params, HttpVersion.HTTP_1_1 );

        ClientConnectionManager cm = new ThreadSafeClientConnManager( params, schemeRegistry );
View Full Code Here

     *
     * @since 4.1
     */
    public ThreadSafeClientConnManager(final SchemeRegistry schreg,
            long connTTL, TimeUnit connTTLTimeUnit) {
        this(schreg, connTTL, connTTLTimeUnit, new ConnPerRouteBean());
    }
View Full Code Here

        if (schreg == null) {
            throw new IllegalArgumentException("Scheme registry may not be null");
        }
        this.log = LogFactory.getLog(getClass());
        this.schemeRegistry = schreg;
        this.connPerRoute = new ConnPerRouteBean();
        this.connOperator = createConnectionOperator(schreg);
        this.pool = (ConnPoolByRoute) createConnectionPool(params) ;
        this.connectionPool = this.pool;
    }
View Full Code Here

   
    public void testIdleConnectionEviction() throws Exception {
        HttpParams params = new BasicHttpParams();
        HttpConnectionParams.setStaleCheckingEnabled(params, false);
        ConnManagerParams.setMaxTotalConnections(params, 50);
        ConnManagerParams.setMaxConnectionsPerRoute(params, new ConnPerRouteBean(10));
       
        SchemeRegistry schemeRegistry = new SchemeRegistry();
        schemeRegistry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
       
        ThreadSafeClientConnManager cm = new ThreadSafeClientConnManager(params, schemeRegistry);
View Full Code Here

        HttpHost target = new HttpHost("localhost", port);
       
        HttpParams params = defaultParams.copy();
        ConnManagerParams.setMaxTotalConnections(params, workerCount);
        ConnManagerParams.setMaxConnectionsPerRoute(params,
                new ConnPerRouteBean(workerCount));
        ConnManagerParams.setTimeout(params, 10L);
       
        ThreadSafeClientConnManager mgr = new ThreadSafeClientConnManager(
                params, supportedSchemes);       
       
View Full Code Here

        // We build a client with 2 max active // connections, and 2 max per route.
        HttpParams params = defaultParams.copy();
        ConnManagerParams.setMaxTotalConnections(params, maxConn);
        ConnManagerParams.setMaxConnectionsPerRoute(params,
                new ConnPerRouteBean(maxConn));
       
        ThreadSafeClientConnManager connMngr = new ThreadSafeClientConnManager(
                params, supportedSchemes);       

        DefaultHttpClient client = new DefaultHttpClient(connMngr, params);
View Full Code Here

TOP

Related Classes of org.apache.http.conn.params.ConnPerRouteBean

Copyright © 2018 www.massapicom. 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.