public class FixedChannelPool extends SimpleChannelPool
ChannelPool implementation that takes another ChannelPool implementation and enforce a maximum
number of concurrent connections.| 限定符和类型 | 类和说明 |
|---|---|
static class |
FixedChannelPool.AcquireTimeoutAction |
| 构造器和说明 |
|---|
FixedChannelPool(Bootstrap bootstrap,
ChannelPoolHandler handler,
ChannelHealthChecker healthCheck,
FixedChannelPool.AcquireTimeoutAction action,
long acquireTimeoutMillis,
int maxConnections,
int maxPendingAcquires)
Creates a new instance.
|
FixedChannelPool(Bootstrap bootstrap,
ChannelPoolHandler handler,
ChannelHealthChecker healthCheck,
FixedChannelPool.AcquireTimeoutAction action,
long acquireTimeoutMillis,
int maxConnections,
int maxPendingAcquires,
boolean releaseHealthCheck)
Creates a new instance.
|
FixedChannelPool(Bootstrap bootstrap,
ChannelPoolHandler handler,
ChannelHealthChecker healthCheck,
FixedChannelPool.AcquireTimeoutAction action,
long acquireTimeoutMillis,
int maxConnections,
int maxPendingAcquires,
boolean releaseHealthCheck,
boolean lastRecentUsed)
Creates a new instance.
|
FixedChannelPool(Bootstrap bootstrap,
ChannelPoolHandler handler,
int maxConnections)
Creates a new instance using the
ChannelHealthChecker.ACTIVE. |
FixedChannelPool(Bootstrap bootstrap,
ChannelPoolHandler handler,
int maxConnections,
int maxPendingAcquires)
Creates a new instance using the
ChannelHealthChecker.ACTIVE. |
| 限定符和类型 | 方法和说明 |
|---|---|
Future<Channel> |
acquire(Promise<Channel> promise)
Acquire a
Channel from this ChannelPool. |
void |
close() |
Future<java.lang.Void> |
release(Channel channel,
Promise<java.lang.Void> promise)
Release a
Channel back to this ChannelPool. |
acquire, bootstrap, connectChannel, handler, healthChecker, offerChannel, pollChannel, release, releaseHealthCheckpublic FixedChannelPool(Bootstrap bootstrap, ChannelPoolHandler handler, int maxConnections)
ChannelHealthChecker.ACTIVE.bootstrap - the Bootstrap that is used for connectionshandler - the ChannelPoolHandler that will be notified for the different pool actionsmaxConnections - the number of maximal active connections, once this is reached new tries to acquire
a Channel will be delayed until a connection is returned to the pool again.public FixedChannelPool(Bootstrap bootstrap, ChannelPoolHandler handler, int maxConnections, int maxPendingAcquires)
ChannelHealthChecker.ACTIVE.bootstrap - the Bootstrap that is used for connectionshandler - the ChannelPoolHandler that will be notified for the different pool actionsmaxConnections - the number of maximal active connections, once this is reached new tries to
acquire a Channel will be delayed until a connection is returned to the
pool again.maxPendingAcquires - the maximum number of pending acquires. Once this is exceed acquire tries will
be failed.public FixedChannelPool(Bootstrap bootstrap, ChannelPoolHandler handler, ChannelHealthChecker healthCheck, FixedChannelPool.AcquireTimeoutAction action, long acquireTimeoutMillis, int maxConnections, int maxPendingAcquires)
bootstrap - the Bootstrap that is used for connectionshandler - the ChannelPoolHandler that will be notified for the different pool actionshealthCheck - the ChannelHealthChecker that will be used to check if a Channel is
still healthy when obtain from the ChannelPoolaction - the FixedChannelPool.AcquireTimeoutAction to use or null if non should be used.
In this case must be -1.acquireTimeoutMillis - the time (in milliseconds) after which an pending acquire must complete or
the FixedChannelPool.AcquireTimeoutAction takes place.maxConnections - the number of maximal active connections, once this is reached new tries to
acquire a Channel will be delayed until a connection is returned to the
pool again.maxPendingAcquires - the maximum number of pending acquires. Once this is exceed acquire tries will
be failed.public FixedChannelPool(Bootstrap bootstrap, ChannelPoolHandler handler, ChannelHealthChecker healthCheck, FixedChannelPool.AcquireTimeoutAction action, long acquireTimeoutMillis, int maxConnections, int maxPendingAcquires, boolean releaseHealthCheck)
bootstrap - the Bootstrap that is used for connectionshandler - the ChannelPoolHandler that will be notified for the different pool actionshealthCheck - the ChannelHealthChecker that will be used to check if a Channel is
still healthy when obtain from the ChannelPoolaction - the FixedChannelPool.AcquireTimeoutAction to use or null if non should be used.
In this case must be -1.acquireTimeoutMillis - the time (in milliseconds) after which an pending acquire must complete or
the FixedChannelPool.AcquireTimeoutAction takes place.maxConnections - the number of maximal active connections, once this is reached new tries to
acquire a Channel will be delayed until a connection is returned to the
pool again.maxPendingAcquires - the maximum number of pending acquires. Once this is exceed acquire tries will
be failed.releaseHealthCheck - will check channel health before offering back if this parameter set to
true.public FixedChannelPool(Bootstrap bootstrap, ChannelPoolHandler handler, ChannelHealthChecker healthCheck, FixedChannelPool.AcquireTimeoutAction action, long acquireTimeoutMillis, int maxConnections, int maxPendingAcquires, boolean releaseHealthCheck, boolean lastRecentUsed)
bootstrap - the Bootstrap that is used for connectionshandler - the ChannelPoolHandler that will be notified for the different pool actionshealthCheck - the ChannelHealthChecker that will be used to check if a Channel is
still healthy when obtain from the ChannelPoolaction - the FixedChannelPool.AcquireTimeoutAction to use or null if non should be used.
In this case must be -1.acquireTimeoutMillis - the time (in milliseconds) after which an pending acquire must complete or
the FixedChannelPool.AcquireTimeoutAction takes place.maxConnections - the number of maximal active connections, once this is reached new tries to
acquire a Channel will be delayed until a connection is returned to the
pool again.maxPendingAcquires - the maximum number of pending acquires. Once this is exceed acquire tries will
be failed.releaseHealthCheck - will check channel health before offering back if this parameter set to
true.lastRecentUsed - true Channel selection will be LIFO, if false FIFO.public Future<Channel> acquire(Promise<Channel> promise)
ChannelPoolChannel from this ChannelPool. The given Promise is notified once
the acquire is successful and failed otherwise.
Its important that an acquired is always released to the pool again, even if the Channel
is explicitly closed..acquire 在接口中 ChannelPoolacquire 在类中 SimpleChannelPoolpublic Future<java.lang.Void> release(Channel channel, Promise<java.lang.Void> promise)
ChannelPoolChannel back to this ChannelPool. The given Promise is notified once
the release is successful and failed otherwise. When failed the Channel will automatically closed.release 在接口中 ChannelPoolrelease 在类中 SimpleChannelPoolpublic void close()
close 在接口中 ChannelPoolclose 在接口中 java.io.Closeableclose 在接口中 java.lang.AutoCloseableclose 在类中 SimpleChannelPool