This class is derived from MultiThreadedHttpConnectionManager
in HttpClient 3.x, see there for original authors. It implements the same algorithm for connection re-use and connection-per-host enforcement:
-
connections are re-used only for the exact same route
-
connection limits are enforced per route rather than per host
Note that access to the pool datastructures is synchronized via the #poolLock poolLock in the base class, not via synchronized
methods.
- Author
- Roland Weber
-
Michael Becke
-
and others
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.
*/
|
| ConnPoolByRoute (final ClientConnectionOperator operator, final HttpParams params) |
| Creates a new connection pool, managed by route.
|
|
PoolEntryRequest | requestPoolEntry (final HttpRoute route, final Object state) |
| Returns a new com.good.gd.apache.http.impl.conn.tsccm.PoolEntryRequest, from which a com.good.gd.apache.http.impl.conn.tsccm.BasicPoolEntry can be obtained, or the request can be aborted. More...
|
|
void | freeEntry (BasicPoolEntry entry, boolean reusable, long validDuration, TimeUnit timeUnit) |
| Returns an entry into the pool. More...
|
|
void | deleteClosedConnections () |
| Deletes all entries for closed connections.
|
|
void | shutdown () |
| Shuts down this pool and all associated resources. More...
|
|
void | enableConnectionGC () throws IllegalStateException |
| Enables connection garbage collection (GC). More...
|
|
final BasicPoolEntry | getEntry (HttpRoute route, Object state, long timeout, TimeUnit tunit) throws ConnectionPoolTimeoutException, InterruptedException |
| Obtains a pool entry with a connection within the given timeout. More...
|
|
void | closeIdleConnections (long idletime, TimeUnit tunit) |
| Closes idle connections. More...
|
|
Public Member Functions inherited from RefQueueHandler |
void | handleReference (Reference<?> ref) |
| Invoked when a reference is found on the queue. More...
|
|
|
Queue< BasicPoolEntry > | createFreeConnQueue () |
| Creates the queue for freeConnections. More...
|
|
Queue< WaitingThread > | createWaitingThreadQueue () |
| Creates the queue for waitingThreads. More...
|
|
Map< HttpRoute, RouteSpecificPool > | createRouteToPoolMap () |
| Creates the map for routeToPool. More...
|
|
RouteSpecificPool | newRouteSpecificPool (HttpRoute route) |
| Creates a new route-specific pool. More...
|
|
WaitingThread | newWaitingThread (Condition cond, RouteSpecificPool rospl) |
| Creates a new waiting thread. More...
|
|
RouteSpecificPool | getRoutePool (HttpRoute route, boolean create) |
| Get a route-specific pool of available connections. More...
|
|
BasicPoolEntry | getEntryBlocking (HttpRoute route, Object state, long timeout, TimeUnit tunit, WaitingThreadAborter aborter) throws ConnectionPoolTimeoutException, InterruptedException |
| Obtains a pool entry with a connection within the given timeout. More...
|
|
BasicPoolEntry | getFreeEntry (RouteSpecificPool rospl, Object state) |
| If available, get a free pool entry for a route. More...
|
|
BasicPoolEntry | createEntry (RouteSpecificPool rospl, ClientConnectionOperator op) |
| Creates a new pool entry. More...
|
|
void | deleteEntry (BasicPoolEntry entry) |
| Deletes a given pool entry. More...
|
|
void | deleteLeastUsedEntry () |
| Delete an old, free pool entry to make room for a new one. More...
|
|
void | handleLostEntry (HttpRoute route) |
| Handles cleaning up for a lost pool entry with the given route. More...
|
|
void | notifyWaitingThread (RouteSpecificPool rospl) |
| Notifies a waiting thread that a connection is available. More...
|
|
| AbstractConnPool () |
| Creates a new connection pool.
|
|
void | closeConnection (final OperatedClientConnection conn) |
| Closes a connection from this pool. More...
|
|