Examples of HttpConnectionManager


Examples of org.apache.commons.httpclient.HttpConnectionManager

     * @return A new {@link HttpClient}
     */
    public static HttpClient newHttpClient(RiakConfig config) {

        HttpClient http = config.getHttpClient();
        HttpConnectionManager m;

        if (http == null) {
            m = new MultiThreadedHttpConnectionManager();
            http = new HttpClient(m);
        } else {
            m = http.getHttpConnectionManager();
        }

        HttpConnectionManagerParams mp = m.getParams();
        if (config.getMaxConnections() != null) {
          mp.setMaxTotalConnections(config.getMaxConnections());
          mp.setMaxConnectionsPerHost(HostConfiguration.ANY_HOST_CONFIGURATION, config.getMaxConnections());
        }

View Full Code Here

Examples of org.apache.commons.httpclient.HttpConnectionManager

    public boolean interrupt() {
        HttpClient client = savedClient;
        if (client != null) {
            savedClient = null;
            // TODO - not sure this is the best method
            final HttpConnectionManager httpConnectionManager = client.getHttpConnectionManager();
            if (httpConnectionManager instanceof SimpleHttpConnectionManager) {// Should be true
                ((SimpleHttpConnectionManager)httpConnectionManager).shutdown();
            }
        }
        return client != null;
View Full Code Here

Examples of org.apache.commons.httpclient.HttpConnectionManager

        int maxHostConnections = 20;

        HttpConnectionManagerParams params = new HttpConnectionManagerParams();
        params.setMaxConnectionsPerHost( hostConfig, maxHostConnections );

        HttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager();
        connectionManager.setParams( params );

        org.apache.commons.httpclient.HttpClient client = new org.apache.commons.httpclient.HttpClient(
            connectionManager );

        Credentials creds = new org.apache.commons.httpclient.UsernamePasswordCredentials( username, password );
View Full Code Here

Examples of org.apache.commons.httpclient.HttpConnectionManager

    public synchronized void run() {
        while (!shutdown) {
            Iterator iter = connectionManagers.iterator();
           
            while (iter.hasNext()) {
                HttpConnectionManager connectionManager = (HttpConnectionManager) iter.next();
                connectionManager.closeIdleConnections(connectionTimeout);
            }
           
            try {
                this.wait(timeoutInterval);
            } catch (InterruptedException e) {
View Full Code Here

Examples of org.apache.commons.httpclient.HttpConnectionManager

    public synchronized void run() {
        while (!shutdown) {
            Iterator iter = connectionManagers.iterator();
           
            while (iter.hasNext()) {
                HttpConnectionManager connectionManager = (HttpConnectionManager) iter.next();
                handleCloseIdleConnections(connectionManager);
            }
           
            try {
                this.wait(timeoutInterval);
View Full Code Here

Examples of org.apache.commons.httpclient.HttpConnectionManager

    public boolean interrupt() {
        HttpClient client = savedClient;
        if (client != null) {
            savedClient = null;
            // TODO - not sure this is the best method
            final HttpConnectionManager httpConnectionManager = client.getHttpConnectionManager();
            if (httpConnectionManager instanceof SimpleHttpConnectionManager) {// Should be true
                ((SimpleHttpConnectionManager)httpConnectionManager).shutdown();
            }
        }
        return client != null;
View Full Code Here

Examples of org.apache.commons.httpclient.HttpConnectionManager

    /**
     * @return the HTTP connection factory, creating one if required
     */
    public HttpConnectionManager getConnectionManager() {
        if ( connectionManager == null ) {
            connectionManager = new HttpConnectionManager();
        }
        return connectionManager;
    }
View Full Code Here

Examples of org.apache.commons.httpclient.HttpConnectionManager

    public synchronized void run() {
        while (!shutdown) {
            Iterator iter = connectionManagers.iterator();
           
            while (iter.hasNext()) {
                HttpConnectionManager connectionManager = (HttpConnectionManager) iter.next();
                handleCloseIdleConnections(connectionManager);
            }
           
            try {
                this.wait(timeoutInterval);
View Full Code Here

Examples of org.apache.commons.httpclient.HttpConnectionManager

        }
        if (httpClient != null) {
            return httpClient;
        }

        HttpConnectionManager connManager =
            (HttpConnectionManager) msgContext.getProperty(
                 HTTPConstants.MULTITHREAD_HTTP_CONNECTION_MANAGER);
        if (connManager == null) {
            connManager =
                (HttpConnectionManager) msgContext.getProperty(
View Full Code Here

Examples of org.apache.commons.httpclient.HttpConnectionManager

     * held open. This is an optional method, and callers are not expected to
     * call it, but can if they want to explicitly release any open resources.
     * Once a client has been shutdown, it cannot be used to make more requests.
     */
    public void shutdown() {
        HttpConnectionManager connectionManager = httpClient.getHttpConnectionManager();
        if (connectionManager instanceof MultiThreadedHttpConnectionManager) {
            ((MultiThreadedHttpConnectionManager)connectionManager).shutdown();
        }
    }
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.