@Contract(threading=SAFE_CONDITIONAL) @Deprecated public class ThreadSafeClientConnManager extends Object implements ClientConnectionManager
OperatedClientConnection的池,并能够服务来自多个执行线程的连接请求。
连接按每个路线合并。
对于已经具有持续连接以在池中可用的路由的请求将是通过从池中租用连接而不是创建全新连接来进行的服务。
ThreadSafeClientConnManager在每个路由基础上总共维护连接的最大限制。 默认情况下,此实施方案将在每个给定路由上创建不超过2个并发连接,并且不再有20个连接。 对于许多现实世界的应用程序,这些限制可能被证明是太限制的,特别是如果他们使用HTTP作为其服务的传输协议。 然而,连接限制可以使用HTTP参数进行调整。
| Modifier and Type | Field and Description |
|---|---|
protected AbstractConnPool |
connectionPool
已过时。
|
protected ClientConnectionOperator |
connOperator
已过时。
用于打开和更新连接的操作员。
|
protected ConnPerRouteBean |
connPerRoute
已过时。
|
protected ConnPoolByRoute |
pool
已过时。
正在管理的连接池。
|
protected SchemeRegistry |
schemeRegistry
已过时。
该连接管理器支持的方案。
|
| Constructor and Description |
|---|
ThreadSafeClientConnManager()
已过时。
|
ThreadSafeClientConnManager(HttpParams params, SchemeRegistry schreg)
已过时。
|
ThreadSafeClientConnManager(SchemeRegistry schreg)
已过时。
创建一个新的线程安全连接管理器。
|
ThreadSafeClientConnManager(SchemeRegistry schreg, long connTTL, TimeUnit connTTLTimeUnit)
已过时。
创建一个新的线程安全连接管理器。
|
ThreadSafeClientConnManager(SchemeRegistry schreg, long connTTL, TimeUnit connTTLTimeUnit, ConnPerRouteBean connPerRoute)
已过时。
创建一个新的线程安全连接管理器。
|
| Modifier and Type | Method and Description |
|---|---|
void |
closeExpiredConnections()
已过时。
关闭池中的所有过期连接。
|
void |
closeIdleConnections(long idleTimeout, TimeUnit tunit)
已过时。
关闭池中的空闲连接。
|
protected ClientConnectionOperator |
createConnectionOperator(SchemeRegistry schreg)
已过时。
钩子用于创建连接运算符。
|
protected AbstractConnPool |
createConnectionPool(HttpParams params)
已过时。
(4.1)使用#createConnectionPool(long,TimeUnit))
|
protected ConnPoolByRoute |
createConnectionPool(long connTTL, TimeUnit connTTLTimeUnit)
已过时。
挂钩创建连接池。
|
protected void |
finalize()
已过时。
|
int |
getConnectionsInPool()
已过时。
获取池连接的总数。
|
int |
getConnectionsInPool(HttpRoute route)
已过时。
获取给定路由的总共连接数。
|
int |
getDefaultMaxPerRoute()
已过时。
|
int |
getMaxForRoute(HttpRoute route)
已过时。
|
int |
getMaxTotal()
已过时。
自4.1
|
SchemeRegistry |
getSchemeRegistry()
已过时。
获得该经理使用的方案注册表。
|
void |
releaseConnection(ManagedClientConnection conn, long validDuration, TimeUnit timeUnit)
已过时。
释放其他人使用的连接。
|
ClientConnectionRequest |
requestConnection(HttpRoute route, Object state)
已过时。
返回一个新的 ClientConnectionRequest ,从中可以获得ManagedClientConnection或请求可以中止。
|
void |
setDefaultMaxPerRoute(int max)
已过时。
|
void |
setMaxForRoute(HttpRoute route, int max)
已过时。
|
void |
setMaxTotal(int max)
已过时。
自4.1
|
void |
shutdown()
已过时。
关闭此连接管理器并释放分配的资源。
|
protected final SchemeRegistry schemeRegistry
protected final AbstractConnPool connectionPool
protected final ConnPoolByRoute pool
protected final ClientConnectionOperator connOperator
protected final ConnPerRouteBean connPerRoute
public ThreadSafeClientConnManager(SchemeRegistry schreg)
schreg - 方案注册表。
public ThreadSafeClientConnManager()
public ThreadSafeClientConnManager(SchemeRegistry schreg, long connTTL, TimeUnit connTTLTimeUnit)
schreg - 方案注册表。
connTTL - 最大连接寿命,<= 0表示“无限远”
connTTLTimeUnit -
connTTLTimeUnit TimeUnit
public ThreadSafeClientConnManager(SchemeRegistry schreg, long connTTL, TimeUnit connTTLTimeUnit, ConnPerRouteBean connPerRoute)
schreg - 方案注册表。
connTTL - 最大连接寿命,<= 0表示“无限远”
connTTLTimeUnit -
connTTLTimeUnit TimeUnit
connPerRoute - 映射每个路由的最大连接,作为依赖关系提供,因此可以从外部进行管理,例如动态连接池大小管理。
@Deprecated public ThreadSafeClientConnManager(HttpParams params, SchemeRegistry schreg)
ThreadSafeClientConnManager(SchemeRegistry)
params - 该经理的参数。
schreg - 方案注册表。
@Deprecated protected AbstractConnPool createConnectionPool(HttpParams params)
protected ConnPoolByRoute createConnectionPool(long connTTL, TimeUnit connTTLTimeUnit)
protected ClientConnectionOperator createConnectionOperator(SchemeRegistry schreg)
schreg - 方案注册表。
public SchemeRegistry getSchemeRegistry()
ClientConnectionManager复制
getSchemeRegistry在接口
ClientConnectionManager
null
public ClientConnectionRequest requestConnection(HttpRoute route, Object state)
ClientConnectionManager复制
ClientConnectionRequest ,从中可以获得ManagedClientConnection或请求可以中止。
requestConnection在接口
ClientConnectionManager
public void releaseConnection(ManagedClientConnection conn, long validDuration, TimeUnit timeUnit)
ClientConnectionManager复制
releaseConnection在接口
ClientConnectionManager
conn - 要发布的连接
validDuration - 此连接有效重用的持续时间
timeUnit - 测量时间的有效期的单位
ClientConnectionManager.closeExpiredConnections()
public void shutdown()
ClientConnectionManager复制
shutdown在接口
ClientConnectionManager
public int getConnectionsInPool(HttpRoute route)
route - 有问题的路线
public int getConnectionsInPool()
public void closeIdleConnections(long idleTimeout,
TimeUnit tunit)
ClientConnectionManager复制
closeIdleConnections在接口
ClientConnectionManager
idleTimeout - 要关闭连接的空闲时间
tunit -为对所述单元
idletime
ClientConnectionManager.closeExpiredConnections()
public void closeExpiredConnections()
ClientConnectionManager复制
closeExpiredConnections在接口
ClientConnectionManager
public int getMaxTotal()
public void setMaxTotal(int max)
public int getDefaultMaxPerRoute()
public void setDefaultMaxPerRoute(int max)
public int getMaxForRoute(HttpRoute route)
public void setMaxForRoute(HttpRoute route, int max)
Copyright © 1999–2017 The Apache Software Foundation. All rights reserved.