Package org.apache.commons.httpclient.util

Examples of org.apache.commons.httpclient.util.IdleConnectionTimeoutThread


     */
    public void testTimeoutThread() {
       
        TimeoutHttpConnectionManager cm = new TimeoutHttpConnectionManager();       
       
        IdleConnectionTimeoutThread timeoutThread = new IdleConnectionTimeoutThread();
        timeoutThread.addConnectionManager(cm);
        timeoutThread.setTimeoutInterval(100);
        timeoutThread.start();
       
        synchronized(this) {
            try {
                this.wait(250);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
       
        assertTrue("closeIdleConnections() not called", cm.closed);

        timeoutThread.removeConnectionManager(cm);
        cm.closed = false;
       
        synchronized(this) {
            try {
                this.wait(250);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }

        assertFalse("closeIdleConnections() called", cm.closed);
       
        timeoutThread.shutdown();
    }   
View Full Code Here


     */
    public void testTimeoutThread() {
       
        TimeoutHttpConnectionManager cm = new TimeoutHttpConnectionManager();       
       
        IdleConnectionTimeoutThread timeoutThread = new IdleConnectionTimeoutThread();
        timeoutThread.addConnectionManager(cm);
        timeoutThread.setTimeoutInterval(100);
        timeoutThread.start();
       
        synchronized(this) {
            try {
                this.wait(250);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
       
        assertTrue("closeIdleConnections() not called", cm.closed);

        timeoutThread.removeConnectionManager(cm);
        cm.closed = false;
       
        synchronized(this) {
            try {
                this.wait(250);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }

        assertFalse("closeIdleConnections() called", cm.closed);
       
        timeoutThread.shutdown();
    }   
View Full Code Here

        }
        httpConnectionManager.getParams().setDefaultMaxConnectionsPerHost(max_per_host);
        httpConnectionManager.getParams().setMaxTotalConnections(max_total);

        // Register the connection manager to a idle check thread
        idleConnectionTimeoutThread = new IdleConnectionTimeoutThread();
        idleConnectionTimeoutThread.setName("Http_Idle_Connection_Timeout_Thread");
        long idleConnectionTimeout = Long.parseLong(_odeConfig.getProperty("http.idle.connection.timeout", "30000"));
        long idleConnectionCheckInterval = Long.parseLong(_odeConfig.getProperty("http.idle.connection.check.interval", "30000"));

        if(__log.isDebugEnabled()){
View Full Code Here

        }
        httpConnectionManager.getParams().setDefaultMaxConnectionsPerHost(max_per_host);
        httpConnectionManager.getParams().setMaxTotalConnections(max_total);

        // Register the connection manager to a idle check thread
        idleConnectionTimeoutThread = new IdleConnectionTimeoutThread();
        idleConnectionTimeoutThread.setName("Http_Idle_Connection_Timeout_Thread");
        long idleConnectionTimeout = Long.parseLong(_odeConfig.getProperty("http.idle.connection.timeout", "30000"));
        long idleConnectionCheckInterval = Long.parseLong(_odeConfig.getProperty("http.idle.connection.check.interval", "30000"));

        if(__log.isDebugEnabled()){
View Full Code Here

        }
        httpConnectionManager.getParams().setDefaultMaxConnectionsPerHost(max_per_host);
        httpConnectionManager.getParams().setMaxTotalConnections(max_total);

        // Register the connection manager to a idle check thread
        idleConnectionTimeoutThread = new IdleConnectionTimeoutThread();
        idleConnectionTimeoutThread.setName("Http_Idle_Connection_Timeout_Thread");
        long idleConnectionTimeout = Long.parseLong(_odeConfig.getProperty("http.idle.connection.timeout", "30000"));
        long idleConnectionCheckInterval = Long.parseLong(_odeConfig.getProperty("http.idle.connection.check.interval", "30000"));

        if(__log.isDebugEnabled()){
View Full Code Here

            idleConnectionTimeoutThread = null;
        }

        int requestTimeout = requestTimeout(config, request.getPerRequestConfig());
        if (config.getIdleConnectionTimeoutInMs() > 0 && requestTimeout != -1 && requestTimeout < config.getIdleConnectionTimeoutInMs()) {
            idleConnectionTimeoutThread = new IdleConnectionTimeoutThread();
            idleConnectionTimeoutThread.setConnectionTimeout(config.getIdleConnectionTimeoutInMs());
            idleConnectionTimeoutThread.addConnectionManager(connectionManager);
            idleConnectionTimeoutThread.start();
        }
View Full Code Here

            clientConnectionManager = new MultiThreadedHttpConnectionManager();
            String prop = System.getProperty("mule.http.disableCleanupThread");
            disableCleanupThread = prop != null && prop.equals("true");
            if (!disableCleanupThread)
            {
                connectionCleaner = new IdleConnectionTimeoutThread();
                connectionCleaner.setName("HttpClient-connection-cleaner-" + getName());
                connectionCleaner.addConnectionManager(clientConnectionManager);
                connectionCleaner.start();
            }
View Full Code Here

            externalConnMgr.setParams(extParams);
        }
       
        if ((connMgr != null) && (externalConnMgr != null)) {
            if (connReaper == null) {
                connReaper = new IdleConnectionTimeoutThread();
               
                connReaper.setConnectionTimeout(poolTimeout);
                connReaper.setTimeoutInterval(CM_REAP_PERIOD);

                connReaper.addConnectionManager(connMgr);
View Full Code Here

        }
        httpConnectionManager.getParams().setDefaultMaxConnectionsPerHost(max_per_host);
        httpConnectionManager.getParams().setMaxTotalConnections(max_total);

        // Register the connection manager to a idle check thread
        idleConnectionTimeoutThread = new IdleConnectionTimeoutThread();
        idleConnectionTimeoutThread.setName("Http_Idle_Connection_Timeout_Thread");
        long idleConnectionTimeout = Long.parseLong(_odeConfig.getProperty("http.idle.connection.timeout", "30000"));
        long idleConnectionCheckInterval = Long.parseLong(_odeConfig.getProperty("http.idle.connection.check.interval", "30000"));

        if(__log.isDebugEnabled()){
View Full Code Here

     */
    public void testTimeoutThread() {
       
        TimeoutHttpConnectionManager cm = new TimeoutHttpConnectionManager();       
       
        IdleConnectionTimeoutThread timeoutThread = new IdleConnectionTimeoutThread();
        timeoutThread.addConnectionManager(cm);
        timeoutThread.setTimeoutInterval(100);
        timeoutThread.start();
       
        synchronized(this) {
            try {
                this.wait(250);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
       
        assertTrue("closeIdleConnections() not called", cm.closed);

        timeoutThread.removeConnectionManager(cm);
        cm.closed = false;
       
        synchronized(this) {
            try {
                this.wait(250);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }

        assertFalse("closeIdleConnections() called", cm.closed);
       
        timeoutThread.shutdown();
    }   
View Full Code Here

TOP

Related Classes of org.apache.commons.httpclient.util.IdleConnectionTimeoutThread

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.