Examples of IdleConnectionTimeoutThread


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

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

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

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

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

        // TODO: Modify this and move configuration to bps.xml
        // Register the connection manager to a idle check thread
        idleConnectionTimeoutThread = new IdleConnectionTimeoutThread();
        idleConnectionTimeoutThread.setName("Http_Idle_Connection_Timeout_Thread");
        long idleConnectionTimeout = Long.parseLong(
                odeConfigurationProperties
                        .getProperty("http.idle.connection.timeout", "30000"));
        long idleConnectionCheckInterval = Long.parseLong(
View Full Code Here

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

        }
        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

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

    client.addPropertyInfo(IDLE_CONNECTION_CHECK_INTERVAL_KEY,  "空闲连接检查时间间隔(ms)", "暂未实现动态修改空闲连接检查时间间隔,修改后不会生效!", "1000");
    // 设置
    httpClient = createHttpClient();
    if (httpClient == null)
      throw new NullPointerException("HttpClient == null!");
    idleConnectionTimeoutThread = new IdleConnectionTimeoutThread();
    idleConnectionTimeoutThread.addConnectionManager(httpClient.getHttpConnectionManager());
    httpClient.getHostConfiguration().setHost(hostAddress, hostPort);
    if (connectionTimeout != UNKNOWN_CONNECTION_TIMEOUT)
      httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(connectionTimeout);
    if (socketTimeout != UNKNOWN_SOCKET_TIMEOUT)
View Full Code Here

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

        // 创建一个线程安全的HTTP连接池
        connectionManager = new MultiThreadedHttpConnectionManager();
        connectionManager.getParams().setDefaultMaxConnectionsPerHost(defaultMaxConnPerHost);
        connectionManager.getParams().setMaxTotalConnections(defaultMaxTotalConn);

        IdleConnectionTimeoutThread ict = new IdleConnectionTimeoutThread();
        ict.addConnectionManager(connectionManager);
        ict.setConnectionTimeout(defaultIdleConnTimeout);

        ict.start();
    }
View Full Code Here

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

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

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
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.