Deprecated
(4.2) use org.
org.apache.http.conn.OperatedClientConnection
and is able to service connection requests from multiple execution threads.
Connections are pooled on a per route basis. A request for a route which
already the manager has persistent connections for available in the pool
will be services by leasing a connection from the pool rather than
creating a brand new connection.
ThreadSafeClientConnManager maintains a maximum limit of connection on a per route basis and in total. Per default this implementation will create no more than than 2 concurrent connections per given route and no more 20 connections in total. For many real-world applications these limits may prove too constraining, especially if they use HTTP as a transport protocol for their services. Connection limits, however, can be adjusted using HTTP parameters.
| Modifier and Type | Field and Description |
|---|---|
| protected final AbstractConnPool | connectionPool
Deprecated
as a consequence of
AbstractConnPool being deprecated.
|
| protected final ClientConnectionOperator | connOperator
The operator for opening and updating connections. |
| protected final ConnPerRouteBean | connPerRoute
Deprecated
as a consequence of
ConnPerRouteBean being deprecated.
|
| private final Log | |
| protected final ConnPoolByRoute | pool
The pool of connections being managed. |
| protected final SchemeRegistry | schemeRegistry
The schemes supported by this connection manager. |
| Access | Constructor and Description |
|---|---|
| public | ThreadSafeClientConnManager(final SchemeRegistry
the scheme registry. schreg)
Deprecated
as a consequence of
Creates a new thread safe connection manager.
SchemeRegistry being deprecated.
|
| public | |
| public | ThreadSafeClientConnManager(final SchemeRegistry
the scheme registry. schreg, final long max connection lifetime, <=0 implies "infinity" connTTL, final TimeUnit TimeUnit of connTTL connTTLTimeUnit)
Deprecated
as a consequence of
Creates a new thread safe connection manager.
SchemeRegistry being deprecated.
|
| public | ThreadSafeClientConnManager(final SchemeRegistry
the scheme registry. schreg, final long max connection lifetime, <=0 implies "infinity" connTTL, final TimeUnit TimeUnit of connTTL connTTLTimeUnit, final ConnPerRouteBean mapping of maximum connections per route,
provided as a dependency so it can be managed externally, e.g.
for dynamic connection pool size management. connPerRoute)
Deprecated
as a consequence of
Creates a new thread safe connection manager.
SchemeRegistry and ConnPerRouteBean being deprecated.
|
| public | ThreadSafeClientConnManager(final HttpParams
the parameters for this manager. params, final SchemeRegistry the scheme registry. schreg)
Deprecated
(4.1) use
Creates a new thread safe connection manager.
ThreadSafeClientConnManager#ThreadSafeClientConnManager(SchemeRegistry)
|
| Modifier and Type | Method and Description |
|---|---|
| public void | closeExpiredConnections()
Implements org. |
| public void | closeIdleConnections(final long
the idle time of connections to be closed idleTimeout, final TimeUnit the unit for the timeUnit)idletimeImplements org. |
| protected ClientConnectionOperator | Returns: the connection operator to usethe scheme registry. schreg)
Deprecated
as a consequence of
Hook for creating the connection operator.
SchemeRegistry and ClientConnectionOperator being deprecated.
|
| protected AbstractConnPool | Returns: the connection pool to use
Deprecated
(4.1) use #createConnectionPool(long, TimeUnit))
Hook for creating the connection pool.
|
| protected ConnPoolByRoute | Returns: the connection pool to use
Deprecated
as a consequence of
Hook for creating the connection pool.
ConnPoolByRoute being deprecated.
|
| protected void | finalize()
Overrides java. |
| public int | Returns: the total number of pooled connections for that routethe route in question route)Gets the total number of pooled connections for the given route. |
| public int | Returns: the total number of pooled connectionsGets the total number of pooled connections. |
| public int | |
| public int | |
| public int | |
| public SchemeRegistry | getSchemeRegistry()
Implements org.
Deprecated
as a consequence of
Obtains the scheme registry used by this manager.
SchemeRegistry being deprecated.
|
| public void | releaseConnection(final ManagedClientConnection
the connection to release conn, final long the duration of time this connection is valid for reuse validDuration, final TimeUnit the unit of time validDuration is measured in timeUnit)Implements org.
Deprecated
as a consequence of
Releases a connection for use by others.
ManagedClientConnection being deprecated.
|
| public ClientConnectionRequest | requestConnection(final HttpRoute route, final Object state)
Implements org.
Deprecated
as a consequence of
Returns a new ClientConnectionRequest being deprecated.
ClientConnectionRequest, from which a
ManagedClientConnection can be obtained or the request can be
aborted.
|
| public void | |
| public void | |
| public void | |
| public void | shutdown()
Implements org. |
| connectionPool | back to summary |
|---|---|
| protected final AbstractConnPool connectionPool
Deprecated as a consequence of | |
| connOperator | back to summary |
|---|---|
| protected final ClientConnectionOperator connOperator
Deprecated as a consequence of The operator for opening and updating connections. | |
| connPerRoute | back to summary |
|---|---|
| protected final ConnPerRouteBean connPerRoute
Deprecated as a consequence of | |
| log | back to summary |
|---|---|
| private final Log log | |
| pool | back to summary |
|---|---|
| protected final ConnPoolByRoute pool
Deprecated as a consequence of The pool of connections being managed. | |
| schemeRegistry | back to summary |
|---|---|
| protected final SchemeRegistry schemeRegistry
Deprecated as a consequence of The schemes supported by this connection manager. | |
| ThreadSafeClientConnManager | back to summary |
|---|---|
| public ThreadSafeClientConnManager(final SchemeRegistry schreg)
Deprecated as a consequence of Creates a new thread safe connection manager.
| |
| ThreadSafeClientConnManager | back to summary |
|---|---|
public ThreadSafeClientConnManager()
| |
| ThreadSafeClientConnManager | back to summary |
|---|---|
| public ThreadSafeClientConnManager(final SchemeRegistry schreg, final long connTTL, final TimeUnit connTTLTimeUnit)
Deprecated as a consequence of Creates a new thread safe connection manager.
| |
| ThreadSafeClientConnManager | back to summary |
|---|---|
| public ThreadSafeClientConnManager(final SchemeRegistry schreg, final long connTTL, final TimeUnit connTTLTimeUnit, final ConnPerRouteBean connPerRoute)
Deprecated as a consequence of Creates a new thread safe connection manager.
| |
| ThreadSafeClientConnManager | back to summary |
|---|---|
| public ThreadSafeClientConnManager(final HttpParams params, final SchemeRegistry schreg)
Deprecated (4.1) use Creates a new thread safe connection manager.
| |
| closeExpiredConnections | back to summary |
|---|---|
| public void closeExpiredConnections() Implements org. Doc from org. Closes all expired connections in the pool. Open connections in the pool that have not been used for the timespan defined when the connection was released will be closed. Currently allocated connections are not subject to this method. Times will be checked with milliseconds precision.
| |
| closeIdleConnections | back to summary |
|---|---|
| public void closeIdleConnections(final long idleTimeout, final TimeUnit timeUnit) Implements org. Doc from org. Closes idle connections in the pool. Open connections in the pool that have not been used for the timespan given by the argument will be closed. Currently allocated connections are not subject to this method. Times will be checked with milliseconds precision All expired connections will also be closed. | |
| createConnectionOperator | back to summary |
|---|---|
| protected ClientConnectionOperator createConnectionOperator(final SchemeRegistry schreg)
Deprecated as a consequence of Hook for creating the connection operator.
It is called by the constructor.
Derived classes can override this method to change the
instantiation of the operator.
The default implementation here instantiates
| |
| createConnectionPool | back to summary |
|---|---|
| protected AbstractConnPool createConnectionPool(final HttpParams params)
Deprecated (4.1) use #createConnectionPool(long, TimeUnit)) Hook for creating the connection pool.
| |
| createConnectionPool | back to summary |
|---|---|
| protected ConnPoolByRoute createConnectionPool(final long connTTL, final TimeUnit connTTLTimeUnit)
Deprecated as a consequence of Hook for creating the connection pool.
| |
| finalize | back to summary |
|---|---|
| protected void finalize() throws Throwable Overrides java. Doc from java. Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
A subclass overrides the
When running in a Java virtual machine in which finalization has been
disabled or removed, the garbage collector will never call
The general contract of
The
The Java programming language does not guarantee which thread will
invoke the
After the
The
Any exception thrown by the | |
| getConnectionsInPool | back to summary |
|---|---|
| public int getConnectionsInPool(final HttpRoute route) Gets the total number of pooled connections for the given route. This is the total number of connections that have been created and are still in use by this connection manager for the route. This value will not exceed the maximum number of connections per host.
| |
| getConnectionsInPool | back to summary |
|---|---|
| public int getConnectionsInPool() Gets the total number of pooled connections. This is the total number of connections that have been created and are still in use by this connection manager. This value will not exceed the maximum number of connections in total.
| |
| getDefaultMaxPerRoute | back to summary |
|---|---|
public int getDefaultMaxPerRoute()
| |
| getMaxForRoute | back to summary |
|---|---|
public int getMaxForRoute(final HttpRoute route)
| |
| getMaxTotal | back to summary |
|---|---|
| public int getMaxTotal() since 4.1 | |
| getSchemeRegistry | back to summary |
|---|---|
| public SchemeRegistry getSchemeRegistry() Implements org. Doc from org. Deprecated as a consequence of Obtains the scheme registry used by this manager.
| |
| releaseConnection | back to summary |
|---|---|
| public void releaseConnection(final ManagedClientConnection conn, final long validDuration, final TimeUnit timeUnit) Implements org. Doc from org. Deprecated as a consequence of Releases a connection for use by others. You may optionally specify how long the connection is valid to be reused. Values <= 0 are considered to be valid forever. If the connection is not marked as reusable, the connection will not be reused regardless of the valid duration. If the connection has been released before, the call will be ignored.
| |
| requestConnection | back to summary |
|---|---|
| public ClientConnectionRequest requestConnection(final HttpRoute route, final Object state) Implements org. Doc from org. Deprecated as a consequence of Returns a new
| |
| setDefaultMaxPerRoute | back to summary |
|---|---|
public void setDefaultMaxPerRoute(final int max)
| |
| setMaxForRoute | back to summary |
|---|---|
public void setMaxForRoute(final HttpRoute route, final int max)
| |
| setMaxTotal | back to summary |
|---|---|
| public void setMaxTotal(final int max) since 4.1 | |
| shutdown | back to summary |
|---|---|
| public void shutdown() Implements org. Doc from org. Shuts down this connection manager and releases allocated resources. This includes closing all connections, whether they are currently used or not.
| |