Tabnine Logo
IdleConnectionTimeoutThread
Code IndexAdd Tabnine to your IDE (free)

How to use
IdleConnectionTimeoutThread
in
org.apache.commons.httpclient.util

Best Java code snippets using org.apache.commons.httpclient.util.IdleConnectionTimeoutThread (Showing top 20 results out of 315)

origin: commons-httpclient/commons-httpclient

/**
 * Closes idle connections.
 */
public synchronized void run() {
  while (!shutdown) {
    Iterator iter = connectionManagers.iterator();
    
    while (iter.hasNext()) {
      HttpConnectionManager connectionManager = (HttpConnectionManager) iter.next();
      handleCloseIdleConnections(connectionManager);
    }
    
    try {
      this.wait(timeoutInterval);
    } catch (InterruptedException e) {
    }
  }
  // clear out the connection managers now that we're shutdown
  this.connectionManagers.clear();
}

origin: commons-httpclient/commons-httpclient

public IdleConnectionTimeoutThread() {
  setDaemon(true);
}

origin: mguessan/davmail

/**
 * Create and start a new HttpConnectionManager, close idle connections every minute.
 */
public static void start() {
  synchronized (LOCK) {
    if (httpConnectionManagerThread == null) {
      httpConnectionManagerThread = new IdleConnectionTimeoutThread();
      httpConnectionManagerThread.setName(IdleConnectionTimeoutThread.class.getSimpleName());
      httpConnectionManagerThread.setConnectionTimeout(ONE_MINUTE);
      httpConnectionManagerThread.setTimeoutInterval(ONE_MINUTE);
      httpConnectionManagerThread.start();
    }
  }
}
origin: boyuanitsm/pay

/**
 * 私有的构造方法
 */
private HttpProtocolHandler() {
  // 创建一个线程安全的HTTP连接池
  connectionManager = new MultiThreadedHttpConnectionManager();
  connectionManager.getParams().setDefaultMaxConnectionsPerHost(defaultMaxConnPerHost);
  connectionManager.getParams().setMaxTotalConnections(defaultMaxTotalConn);
  IdleConnectionTimeoutThread ict = new IdleConnectionTimeoutThread();
  ict.addConnectionManager(connectionManager);
  ict.setConnectionTimeout(defaultIdleConnTimeout);
  ict.start();
}
origin: org.mule.transports/mule-transport-http

if (!disableCleanupThread)
  connectionCleaner = new IdleConnectionTimeoutThread();
  connectionCleaner.setName("HttpClient-connection-cleaner-" + getName());
  connectionCleaner.addConnectionManager(clientConnectionManager);
  connectionCleaner.start();
origin: mguessan/davmail

/**
 * Stop HttpConnectionManager.
 */
public static void stop() {
  synchronized (LOCK) {
    if (httpConnectionManagerThread != null) {
      httpConnectionManagerThread.shutdown();
      httpConnectionManagerThread.interrupt();
      httpConnectionManagerThread = null;
    }
    for (MultiThreadedHttpConnectionManager httpConnectionManager : ALL_CONNECTION_MANAGERS) {
      // try to avoid deadlock by connection manager level lock,
      // used internally in MultiThreadedHttpConnectionManager.freeConnection()
      //noinspection SynchronizationOnLocalVariableOrMethodParameter
      synchronized (httpConnectionManager) {
        httpConnectionManager.shutdown();
      }
    }
  }
}
origin: io.gatling/async-http-client

public void close() {
  reaper.shutdown();
  if (idleConnectionTimeoutThread != null) {
    idleConnectionTimeoutThread.shutdown();
    idleConnectionTimeoutThread = null;
  }
  if (connectionManager != null) {
    try {
      connectionManager.shutdown();
    } catch (Exception e) {
      logger.error("Error shutting down connection manager", e);
    }
  }
}
origin: mguessan/davmail

/**
 * Create and set connection pool.
 *
 * @param httpClient httpClient instance
 */
public static void createMultiThreadedHttpConnectionManager(HttpClient httpClient) {
  MultiThreadedHttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager();
  connectionManager.getParams().setDefaultMaxConnectionsPerHost(Settings.getIntProperty("davmail.exchange.maxConnections", 100));
  connectionManager.getParams().setConnectionTimeout(Settings.getIntProperty("davmail.exchange.connectionTimeout", 10) * 1000);
  connectionManager.getParams().setSoTimeout(Settings.getIntProperty("davmail.exchange.soTimeout", 120) * 1000);
  synchronized (LOCK) {
    ALL_CONNECTION_MANAGERS.add(connectionManager);
    httpConnectionManagerThread.addConnectionManager(connectionManager);
  }
  httpClient.setHttpConnectionManager(connectionManager);
}
origin: org.wso2.carbon.business-process/org.wso2.carbon.bpel

idleConnectionTimeoutThread = new IdleConnectionTimeoutThread();
idleConnectionTimeoutThread.setName("Http_Idle_Connection_Timeout_Thread");
long idleConnectionTimeout = Long.parseLong(
    odeConfigurationProperties
  log.debug("http.idle.connection.check.interval=" + idleConnectionCheckInterval);
idleConnectionTimeoutThread.setConnectionTimeout(idleConnectionTimeout);
idleConnectionTimeoutThread.setTimeoutInterval(idleConnectionCheckInterval);
idleConnectionTimeoutThread.addConnectionManager(httpConnectionManager);
idleConnectionTimeoutThread.start();
origin: io.gatling/async-http-client

idleConnectionTimeoutThread.shutdown();
idleConnectionTimeoutThread = null;
idleConnectionTimeoutThread = new IdleConnectionTimeoutThread();
idleConnectionTimeoutThread.setConnectionTimeout(config.getReadTimeout());
idleConnectionTimeoutThread.addConnectionManager(connectionManager);
idleConnectionTimeoutThread.start();
origin: org.wso2.carbon.business-process/org.wso2.carbon.bpel

    log.debug("Shutting down Idle Connection Timeout Thread.");
  idleConnectionTimeoutThread.shutdown();
} catch (Exception e) {
  log.warn("Idle connection timeout thread shutdown failed.");
origin: org.wso2.commons-httpclient/commons-httpclient

public IdleConnectionTimeoutThread() {
  setDaemon(true);
}

origin: org.wso2.commons-httpclient/commons-httpclient

/**
 * Closes idle connections.
 */
public synchronized void run() {
  while (!shutdown) {
    Iterator iter = connectionManagers.iterator();
    
    while (iter.hasNext()) {
      HttpConnectionManager connectionManager = (HttpConnectionManager) iter.next();
      handleCloseIdleConnections(connectionManager);
    }
    
    try {
      this.wait(timeoutInterval);
    } catch (InterruptedException e) {
    }
  }
  // clear out the connection managers now that we're shutdown
  this.connectionManagers.clear();
}

origin: org.mule.transports/mule-transport-http

@Override
protected void doDispose()
{
  if (!disableCleanupThread)
  {
    connectionCleaner.shutdown();
    if (!muleContext.getConfiguration().isStandalone())
    {
      MultiThreadedHttpConnectionManager.shutdownAll();
    }
  }
  if (this.connectionManager != null)
  {
    connectionManager.dispose();
    connectionManager = null;
  }
  super.doDispose();
}
origin: org.apache.commons/com.springsource.org.apache.commons.httpclient

public IdleConnectionTimeoutThread() {
  setDaemon(true);
}

origin: org.apache.commons/com.springsource.org.apache.commons.httpclient

/**
 * Closes idle connections.
 */
public synchronized void run() {
  while (!shutdown) {
    Iterator iter = connectionManagers.iterator();
    
    while (iter.hasNext()) {
      HttpConnectionManager connectionManager = (HttpConnectionManager) iter.next();
      handleCloseIdleConnections(connectionManager);
    }
    
    try {
      this.wait(timeoutInterval);
    } catch (InterruptedException e) {
    }
  }
  // clear out the connection managers now that we're shutdown
  this.connectionManagers.clear();
}

origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-httpclient

public IdleConnectionTimeoutThread() {
  setDaemon(true);
}

origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-httpclient

/**
 * Closes idle connections.
 */
public synchronized void run() {
  while (!shutdown) {
    Iterator iter = connectionManagers.iterator();
    
    while (iter.hasNext()) {
      HttpConnectionManager connectionManager = (HttpConnectionManager) iter.next();
      handleCloseIdleConnections(connectionManager);
    }
    
    try {
      this.wait(timeoutInterval);
    } catch (InterruptedException e) {
    }
  }
  // clear out the connection managers now that we're shutdown
  this.connectionManagers.clear();
}

origin: org.apache.commons/httpclient

public IdleConnectionTimeoutThread() {
  setDaemon(true);
}

origin: org.apache.commons/httpclient

/**
 * Closes idle connections.
 */
public synchronized void run() {
  while (!shutdown) {
    Iterator iter = connectionManagers.iterator();
    
    while (iter.hasNext()) {
      HttpConnectionManager connectionManager = (HttpConnectionManager) iter.next();
      handleCloseIdleConnections(connectionManager);
    }
    
    try {
      this.wait(timeoutInterval);
    } catch (InterruptedException e) {
    }
  }
  // clear out the connection managers now that we're shutdown
  this.connectionManagers.clear();
}

org.apache.commons.httpclient.utilIdleConnectionTimeoutThread

Javadoc

A utility class for periodically closing idle connections.

Most used methods

  • <init>
  • addConnectionManager
    Adds a connection manager to be handled by this class. HttpConnectionManager#closeIdleConnections(lo
  • handleCloseIdleConnections
    Handles calling HttpConnectionManager#closeIdleConnections(long)and doing any other cleanup work on
  • setDaemon
  • start
  • setConnectionTimeout
    Sets the timeout value to use when testing for idle connections.
  • shutdown
    Stops the thread used to close idle connections. This class cannot be used once shutdown.
  • setName
  • setTimeoutInterval
    Sets the interval used by this class between closing idle connections. Idle connections will be clos
  • interrupt

Popular in Java

  • Reading from database using SQL prepared statement
  • requestLocationUpdates (LocationManager)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • compareTo (BigDecimal)
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now