Package org.apache.http.impl.conn.tsccm

Examples of org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager


  /** Called from {@link #init(javax.servlet.ServletConfig)}. HttpClient offers many opportunities for customization.
* @param hcParams*/
  @SuppressWarnings("deprecation")
protected HttpClient createHttpClient(HttpParams hcParams) {
    return new DefaultHttpClient(new ThreadSafeClientConnManager(),hcParams);
  }
View Full Code Here


    else
      httpsScheme = new Scheme("http", 80, PlainSocketFactory.getSocketFactory());
    SchemeRegistry schemeRegistry = new SchemeRegistry();
    schemeRegistry.register(httpsScheme);
    HttpParams params = getHttpParams(connectionTimeout, soTimeout);
    ClientConnectionManager cm = new ThreadSafeClientConnManager(schemeRegistry);
    return new DefaultHttpClient(cm, params);
  }
View Full Code Here

    else
      httpsScheme = new Scheme("http", 80, PlainSocketFactory.getSocketFactory());
    SchemeRegistry schemeRegistry = new SchemeRegistry();
    schemeRegistry.register(httpsScheme);
    HttpParams params = getHttpParams(connectionTimeout, soTimeout);
    ClientConnectionManager cm = new ThreadSafeClientConnManager(schemeRegistry);
    return new DefaultHttpClient(cm, params);
  }
View Full Code Here

    else
      httpsScheme = new Scheme("http", 80, PlainSocketFactory.getSocketFactory());
    SchemeRegistry schemeRegistry = new SchemeRegistry();
    schemeRegistry.register(httpsScheme);
    HttpParams params = getHttpParams(connectionTimeout, soTimeout);
    ClientConnectionManager cm = new ThreadSafeClientConnManager(schemeRegistry);
    return new DefaultHttpClient(cm, params);
  }
View Full Code Here

    else
      httpsScheme = new Scheme("http", 80, PlainSocketFactory.getSocketFactory());
    SchemeRegistry schemeRegistry = new SchemeRegistry();
    schemeRegistry.register(httpsScheme);
    HttpParams params = getHttpParams(connectionTimeout, soTimeout);
    ClientConnectionManager cm = new ThreadSafeClientConnManager(schemeRegistry);
    return new DefaultHttpClient(cm, params);
  }
View Full Code Here

                                                 "users",
                                                 RequestFormatType.VOLDEMORT_V1,
                                                 node.getHttpPort());
        server = context.getServer();

        ThreadSafeClientConnManager connectionManager = new ThreadSafeClientConnManager(SchemeRegistryFactory.createDefault(),
                                                                                        5000,
                                                                                        TimeUnit.MILLISECONDS);
        httpClient = new DefaultHttpClient(connectionManager);
        httpStore = ServerTestUtils.getHttpStore("users",
                                                 RequestFormatType.VOLDEMORT_V1,
View Full Code Here

        VoldemortIOUtils.closeQuietly(client);
        System.exit(1);
    }

    private static HttpClient createClient() {
        ThreadSafeClientConnManager connectionManager = new ThreadSafeClientConnManager(SchemeRegistryFactory.createDefault(),
                                                                                        DEFAULT_CONNECTION_MANAGER_TIMEOUT,
                                                                                        TimeUnit.MILLISECONDS);

        DefaultHttpClient httpClient = new DefaultHttpClient(connectionManager);

        HttpParams clientParams = httpClient.getParams();

        HttpConnectionParams.setSocketBufferSize(clientParams, 60000);
        HttpConnectionParams.setTcpNoDelay(clientParams, false);
        HttpProtocolParams.setUserAgent(clientParams, VOLDEMORT_USER_AGENT);
        HttpProtocolParams.setVersion(clientParams, HttpVersion.HTTP_1_1);
        // HostConfiguration hostConfig = new HostConfiguration();
        // hostConfig.setHost("localhost");

        HttpConnectionParams.setConnectionTimeout(clientParams, DEFAULT_CONNECTION_MANAGER_TIMEOUT);
        HttpConnectionParams.setSoTimeout(clientParams, 500);
        httpClient.setHttpRequestRetryHandler(new DefaultHttpRequestRetryHandler(0, false));
        HttpClientParams.setCookiePolicy(clientParams, CookiePolicy.IGNORE_COOKIES);

        connectionManager.setMaxTotal(DEFAULT_MAX_CONNECTIONS);
        connectionManager.setDefaultMaxPerRoute(DEFAULT_MAX_HOST_CONNECTIONS);
        HttpConnectionParams.setStaleCheckingEnabled(clientParams, false);

        return httpClient;
    }
View Full Code Here

                                                  RequestFormatType.VOLDEMORT_V0,
                                                  numThreads,
                                                  8080);
        httpService.start();

        ThreadSafeClientConnManager connectionManager = new ThreadSafeClientConnManager(SchemeRegistryFactory.createDefault(),
                                                                                        10000,
                                                                                        TimeUnit.MILLISECONDS);

        DefaultHttpClient httpClient = new DefaultHttpClient(connectionManager);

        HttpParams clientParams = httpClient.getParams();
        httpClient.setHttpRequestRetryHandler(new DefaultHttpRequestRetryHandler(0, false));
        HttpClientParams.setCookiePolicy(clientParams, CookiePolicy.IGNORE_COOKIES);
        HttpProtocolParams.setUserAgent(clientParams, "test-agent");
        HttpProtocolParams.setVersion(clientParams, HttpVersion.HTTP_1_1);

        HttpConnectionParams.setConnectionTimeout(clientParams, 10000);

        connectionManager.setMaxTotal(numThreads);
        connectionManager.setDefaultMaxPerRoute(numThreads);
        HttpConnectionParams.setStaleCheckingEnabled(clientParams, false);

        final HttpStore httpStore = new HttpStore("test",
                                                  "localhost",
                                                  8080,
View Full Code Here

    public void testHttpStoreSwapper() throws Exception {
        ExecutorService executor = Executors.newCachedThreadPool();
        DefaultHttpClient client = null;
        try {
            // Use the http store swapper
            ThreadSafeClientConnManager connectionManager = new ThreadSafeClientConnManager();

            connectionManager.setMaxTotal(10);
            connectionManager.setDefaultMaxPerRoute(10);

            client = new DefaultHttpClient(connectionManager);

            StoreSwapper swapper = new HttpStoreSwapper(cluster,
                                                        executor,
View Full Code Here

    public void testHttpStoreSwapperForOffline() throws Exception {
        ExecutorService executor = Executors.newCachedThreadPool();
        DefaultHttpClient client = null;
        try {
            // Use the http store swapper
            ThreadSafeClientConnManager connectionManager = new ThreadSafeClientConnManager();

            connectionManager.setMaxTotal(10);
            connectionManager.setDefaultMaxPerRoute(10);

            client = new DefaultHttpClient(connectionManager);

            StoreSwapper swapper = new HttpStoreSwapper(cluster,
                                                        executor,
View Full Code Here

TOP

Related Classes of org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager

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.