IdleConnectionTimeoutThread (HttpClient Library (Version 3.1))
Date: 2016-03-09

org.apache.commons.httpclient.util

## Class IdleConnectionTimeoutThread

- java.lang.Object
- - java.lang.Thread
  - - org.apache.commons.httpclient.util.IdleConnectionTimeoutThread

- All Implemented Interfaces:
    java.lang.Runnable

      public class IdleConnectionTimeoutThread
      extends java.lang.Thread

  A utility class for periodically closing idle connections.
  Since:
    3.0
  See Also:
    `HttpConnectionManager.closeIdleConnections(long)`

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class java.lang.Thread

      `java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler`

  - ### Field Summary

    - ### Fields inherited from class java.lang.Thread

      `MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `IdleConnectionTimeoutThread()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addConnectionManager(HttpConnectionManager connectionManager)` Adds a connection manager to be handled by this class.
    `protected void` | `handleCloseIdleConnections(HttpConnectionManager connectionManager)` Handles calling `closeIdleConnections()` and doing any other cleanup work on the given connection mangaer.
    `void` | `removeConnectionManager(HttpConnectionManager connectionManager)` Removes the connection manager from this class.
    `void` | `run()` Closes idle connections.
    `void` | `setConnectionTimeout(long connectionTimeout)` Sets the timeout value to use when testing for idle connections.
    `void` | `setTimeoutInterval(long timeoutInterval)` Sets the interval used by this class between closing idle connections.
    `void` | `shutdown()` Stops the thread used to close idle connections.

    - ### Methods inherited from class java.lang.Thread

      `activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield`

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### IdleConnectionTimeoutThread

          public IdleConnectionTimeoutThread()

  - ### Method Detail

    - #### addConnectionManager

          public void addConnectionManager(HttpConnectionManager connectionManager)

      Adds a connection manager to be handled by this class. `HttpConnectionManager.closeIdleConnections(long)` will be called on the connection manager every `timeoutInterval` milliseconds.
      Parameters:
        `connectionManager` - The connection manager to add

    - #### removeConnectionManager

          public void removeConnectionManager(HttpConnectionManager connectionManager)

      Removes the connection manager from this class. The idle connections from the connection manager will no longer be automatically closed by this class.
      Parameters:
        `connectionManager` - The connection manager to remove

    - #### handleCloseIdleConnections

          protected void handleCloseIdleConnections(HttpConnectionManager connectionManager)

      Handles calling `closeIdleConnections()` and doing any other cleanup work on the given connection mangaer.
      Parameters:
        `connectionManager` - The connection manager to close idle connections for

    - #### run

          public void run()

      Closes idle connections.
      Specified by:
        `run` in interface `java.lang.Runnable`
      Overrides:
        `run` in class `java.lang.Thread`

    - #### shutdown

          public void shutdown()

      Stops the thread used to close idle connections. This class cannot be used once shutdown.

    - #### setConnectionTimeout

          public void setConnectionTimeout(long connectionTimeout)

      Sets the timeout value to use when testing for idle connections.
      Parameters:
        `connectionTimeout` - The connection timeout in milliseconds
      See Also:
        `HttpConnectionManager.closeIdleConnections(long)`

    - #### setTimeoutInterval

          public void setTimeoutInterval(long timeoutInterval)

      Sets the interval used by this class between closing idle connections. Idle connections will be closed every `timeoutInterval` milliseconds.
      Parameters:
        `timeoutInterval` - The timeout interval in milliseconds

Copyright (c) 1999-2005 - Apache Software Foundation