Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)
Android APIs
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 ()

Added in API level 1

Public Methods

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

Added in API level 1

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 ()

Added in API level 1

public void closeIdleConnections (long idleTime)

Added in API level 1

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)

Added in API level 1

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 ()

Added in API level 1

Removes all connections referenced by this handler.