public class

IdleConnectionHandler

extends Object
java.lang.Object
   ↳ org.apache.http.impl.conn.IdleConnectionHandler

Class Overview

A helper class for connection managers to track idle connections.

This class is not synchronized.

Summary

Public Constructors
IdleConnectionHandler()
Public Methods
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.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public IdleConnectionHandler ()

Public Methods

public void add (HttpConnection connection, long validDuration, TimeUnit unit)

Registers the given connection with this handler. The connection will be held until remove(HttpConnection) or closeIdleConnections(long) is called.

Parameters
connection the connection to add

public void closeExpiredConnections ()

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

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.

Returns
  • True if the connection is still valid.

public void removeAll ()

Removes all connections referenced by this handler.