• BlackBerry Dynamics
  • Runtime library for Android applications
  • 12.0.1.79
IdleConnectionHandler Class Reference

A helper class for connection managers to track idle connections. More...

Description

This class is not synchronized.

See also
org.apache.http.conn.ClientConnectionManager::closeIdleConnections
Since
4.0

Notice

The following notice applies to the original API on which this API is based, and to its documentation. The documentation of this API has been revised from the original.

/*
 * Copyright (C) 2006 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

Public Member Functions

void add (HttpConnection connection, long validDuration, TimeUnit unit)
 Registers the given connection with this handler. More...
 
boolean remove (HttpConnection connection)
 Removes the given connection from the list of connections to be closed when idle. More...
 
void removeAll ()
 Removes all connections referenced by this handler.
 
void closeIdleConnections (long idleTime)
 Closes connections that have been idle for at least the given amount of time. More...
 

Member Function Documentation

◆ add()

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

The connection will be held until remove or closeIdleConnections is called.

Parameters
connectionthe connection to add
validDuration
unit
See also
remove

◆ remove()

boolean remove ( HttpConnection  connection)

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.

◆ closeIdleConnections()

void closeIdleConnections ( long  idleTime)
Parameters
idleTimethe minimum idle time, in milliseconds, for connections to be closed