Build 1.0_r1(from source)

org.apache.http.impl.conn
Class IdleConnectionHandler

java.lang.Object
  extended by org.apache.http.impl.conn.IdleConnectionHandler

public class IdleConnectionHandler
extends Object

A helper class for connection managers to track idle connections.

This class is not synchronized.

Since:
4.0
See Also:
ClientConnectionManager.closeIdleConnections(long, java.util.concurrent.TimeUnit)

Constructor Summary
IdleConnectionHandler()
           
 
Method Summary
 void add(HttpConnection connection, long validDuration, TimeUnit unit)
          Registers the given connection with this handler.
 void closeExpiredConnections()
           
 void closeIdleConnections(long idleTime)
          Closes connections that have been idle for at least the given amount of time.
 boolean remove(HttpConnection connection)
          Removes the given connection from the list of connections to be closed when idle.
 void removeAll()
          Removes all connections referenced by this handler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IdleConnectionHandler

public IdleConnectionHandler()
Method Detail

add

public void add(HttpConnection connection,
                long validDuration,
                TimeUnit unit)
Registers the given connection with this handler. The connection will be held until remove(org.apache.http.HttpConnection) or closeIdleConnections(long) is called.

Parameters:
connection - the connection to add
See Also:
remove(org.apache.http.HttpConnection)

remove

public boolean remove(HttpConnection connection)
Removes the given connection from the list of connections to be closed when idle. This will return true if the connection is still valid, and false if the connection should be considered expired and not used.

Parameters:
connection -
Returns:
True if the connection is still valid.

removeAll

public void removeAll()
Removes all connections referenced by this handler.


closeIdleConnections

public void closeIdleConnections(long idleTime)
Closes connections that have been idle for at least the given amount of time.

Parameters:
idleTime - the minimum idle time, in milliseconds, for connections to be closed

closeExpiredConnections

public void closeExpiredConnections()

Build 1.0_r1(from source)

Please submit a feedback, bug or feature