A helper class for connection managers to track idle connections. More...
This class is not synchronized.
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... | |
void add | ( | HttpConnection | connection, |
long | validDuration, | ||
TimeUnit | unit | ||
) |
The connection will be held until remove or closeIdleConnections is called.
connection | the connection to add |
validDuration | |
unit |
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.
connection |
void closeIdleConnections | ( | long | idleTime | ) |
idleTime | the minimum idle time, in milliseconds, for connections to be closed |