org.apache.commons.httpclient.util

Class IdleConnectionHandler

public class IdleConnectionHandler extends Object

A helper class for connection managers to track idle connections.

This class is not synchronized.

Since: 3.0

See Also:

Constructor Summary
IdleConnectionHandler()
Method Summary
voidadd(HttpConnection connection)
Registers the given connection with this handler.
voidcloseIdleConnections(long idleTime)
Closes connections that have been idle for at least the given amount of time.
voidremove(HttpConnection connection)
Removes the given connection from the list of connections to be closed when idle.
voidremoveAll()
Removes all connections referenced by this handler.

Constructor Detail

IdleConnectionHandler

public IdleConnectionHandler()

Method Detail

add

public void add(HttpConnection connection)
Registers the given connection with this handler. The connection will be held until {@link #remove(HttpConnection)} or {@link #closeIdleConnections(long)} is called.

Parameters: connection the connection to add

See Also: remove

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

remove

public void remove(HttpConnection connection)
Removes the given connection from the list of connections to be closed when idle.

Parameters: connection

removeAll

public void removeAll()
Removes all connections referenced by this handler.
Copyright (c) 1999-2005 - Apache Software Foundation