public class FixedChannelPool extends SimpleChannelPool
ChannelPool实现需要另一个ChannelPool实现并实施最大数量的并发连接。
| Modifier and Type | Class and Description |
|---|---|
static class |
FixedChannelPool.AcquireTimeoutAction |
| Constructor and Description |
|---|
FixedChannelPool(Bootstrap bootstrap, ChannelPoolHandler handler, ChannelHealthChecker healthCheck, FixedChannelPool.AcquireTimeoutAction action, long acquireTimeoutMillis, int maxConnections, int maxPendingAcquires)
创建一个新的实例。
|
FixedChannelPool(Bootstrap bootstrap, ChannelPoolHandler handler, ChannelHealthChecker healthCheck, FixedChannelPool.AcquireTimeoutAction action, long acquireTimeoutMillis, int maxConnections, int maxPendingAcquires, boolean releaseHealthCheck)
创建一个新的实例。
|
FixedChannelPool(Bootstrap bootstrap, ChannelPoolHandler handler, ChannelHealthChecker healthCheck, FixedChannelPool.AcquireTimeoutAction action, long acquireTimeoutMillis, int maxConnections, int maxPendingAcquires, boolean releaseHealthCheck, boolean lastRecentUsed)
创建一个新的实例。
|
FixedChannelPool(Bootstrap bootstrap, ChannelPoolHandler handler, int maxConnections)
使用
ChannelHealthChecker.ACTIVE创建一个新实例。
|
FixedChannelPool(Bootstrap bootstrap, ChannelPoolHandler handler, int maxConnections, int maxPendingAcquires)
使用
ChannelHealthChecker.ACTIVE创建一个新实例。
|
| Modifier and Type | Method and Description |
|---|---|
Future<Channel> |
acquire(Promise<Channel> promise)
获得 Channel从这个ChannelPool 。
|
void |
close() |
Future<java.lang.Void> |
release(Channel channel, Promise<java.lang.Void> promise)
释放一个 Channel回到这个ChannelPool 。
|
acquire, bootstrap, connectChannel, handler, healthChecker, offerChannel, pollChannel, release, releaseHealthCheckpublic FixedChannelPool(Bootstrap bootstrap, ChannelPoolHandler handler, int maxConnections)
ChannelHealthChecker.ACTIVE创建一个新实例。
bootstrap - 用于连接的Bootstrap
handler - 将通知不同池操作的ChannelPoolHandler
maxConnections - 最大活动连接的数目,一旦达到新的尝试获取Channel将被延迟,直到连接再次返回到池。
public FixedChannelPool(Bootstrap bootstrap, ChannelPoolHandler handler, int maxConnections, int maxPendingAcquires)
ChannelHealthChecker.ACTIVE创建一个新实例。
bootstrap - 用于连接的Bootstrap
handler - 将通知不同池操作的ChannelPoolHandler
maxConnections - 最大活动连接的数量,一旦达到新的尝试获取Channel将被延迟,直到连接再次返回到池。
maxPendingAcquires - 未决获取的最大数量。
一旦这是超过获得尝试将失败。
public FixedChannelPool(Bootstrap bootstrap, ChannelPoolHandler handler, ChannelHealthChecker healthCheck, FixedChannelPool.AcquireTimeoutAction action, long acquireTimeoutMillis, int maxConnections, int maxPendingAcquires)
bootstrap - 用于连接的Bootstrap
handler - 将针对不同池操作通知的ChannelPoolHandler
healthCheck -该ChannelHealthChecker将用来检查一个Channel时从获得仍然是健康ChannelPool
action -在FixedChannelPool.AcquireTimeoutAction使用或null ,如果不应该使用。
在这种情况下必须是-1 。
acquireTimeoutMillis - 必须完成待定采集或发生FixedChannelPool.AcquireTimeoutAction之前的时间(以毫秒为单位)。
maxConnections - 最大活动连接的数目,一旦达到新的尝试获取Channel将被延迟,直到连接再次返回到池。
maxPendingAcquires - 未决获取的最大数量。
一旦这是超过获得尝试将失败。
public FixedChannelPool(Bootstrap bootstrap, ChannelPoolHandler handler, ChannelHealthChecker healthCheck, FixedChannelPool.AcquireTimeoutAction action, long acquireTimeoutMillis, int maxConnections, int maxPendingAcquires, boolean releaseHealthCheck)
bootstrap - 用于连接的Bootstrap
handler - 将通知不同池操作的ChannelPoolHandler
healthCheck - ChannelHealthChecker将用于检查Channel在从ChannelPool获取时是否仍然健康
action -在FixedChannelPool.AcquireTimeoutAction使用或null ,如果不应该使用。
在这种情况下必须是-1 。
acquireTimeoutMillis - 必须完成未决采集或发生FixedChannelPool.AcquireTimeoutAction之前的时间(以毫秒为单位)。
maxConnections - 最大活动连接的数目,一旦达到新的尝试获取Channel将被延迟,直到连接再次返回到池。
maxPendingAcquires - 未决获取的最大数量。
一旦这是超过获得尝试将失败。
releaseHealthCheck - 如果此参数设置为
true将在返回之前检查频道健康状况。
public FixedChannelPool(Bootstrap bootstrap, ChannelPoolHandler handler, ChannelHealthChecker healthCheck, FixedChannelPool.AcquireTimeoutAction action, long acquireTimeoutMillis, int maxConnections, int maxPendingAcquires, boolean releaseHealthCheck, boolean lastRecentUsed)
bootstrap - 用于连接的Bootstrap
handler - 将通知不同池操作的ChannelPoolHandler
healthCheck - ChannelHealthChecker将用于检查Channel从ChannelPool获得时是否仍然健康
action -在FixedChannelPool.AcquireTimeoutAction使用或null ,如果不应该使用。
在这种情况下必须是-1 。
acquireTimeoutMillis - 必须完成未决采集或发生FixedChannelPool.AcquireTimeoutAction之前的时间(以毫秒为单位)。
maxConnections - 最大活动连接的数量,一旦达到新的尝试获取Channel将被延迟,直到连接再次返回到池。
maxPendingAcquires - 未决获取的最大数量。
一旦这是超过获得尝试将失败。
releaseHealthCheck - 如果此参数设置为
true ,
true在返回之前检查渠道运行状况。
lastRecentUsed - true Channel选择将是LIFO,如果是false FIFO。
public Future<Channel> acquire(Promise<Channel> promise)
ChannelPool复制的描述
acquire ,界面
ChannelPool
acquire在课堂上
SimpleChannelPool
public Future<java.lang.Void> release(Channel channel, Promise<java.lang.Void> promise)
ChannelPool
release ,界面
ChannelPool
release在课堂上
SimpleChannelPool
public void close()
close在界面
ChannelPool
close在界面
java.io.Closeable
close ,界面
java.lang.AutoCloseable
close在课堂上
SimpleChannelPool
Copyright © 2008–2018 The Netty Project. All rights reserved.