public class FixedChannelPool extends SimpleChannelPool
ChannelPool implementation that takes another ChannelPool implementation and enforce a maximum
number of concurrent connections.| 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)
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. |
| Modifier and Type | Method and Description |
|---|---|
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 in interface ChannelPoolacquire in class 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 in interface ChannelPoolrelease in class SimpleChannelPoolpublic void close()
close in interface ChannelPoolclose in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class SimpleChannelPoolCopyright © 2008–2018 The Netty Project. All rights reserved.