public final class ListenerInvokingChannelPool extends Object implements SdkChannelPool
SdkChannelPool that wraps and delegates to another SdkChannelPool while invoking ListenerInvokingChannelPool.ChannelPoolListeners
for important events that occur.
ListenerInvokingChannelPool.ChannelPoolListener is similar to Netty's ChannelPoolHandler interface, but by invoking them as part of a
SdkChannelPool wrapper, we are given more control over when they are invoked. For example, HttpOrHttp2ChannelPool may choose not to release HTTP/2 stream channels to the lowest-level pool (and instead store the
channels in its own pool), but by instrumenting listeners that sit on top of this layer, we are still given visibility into
these events occurring.
| Modifier and Type | Class and Description |
|---|---|
static interface |
ListenerInvokingChannelPool.ChannelPoolListener
Listener which is called for various actions performed on a
SdkChannelPool. |
| Constructor and Description |
|---|
ListenerInvokingChannelPool(io.netty.channel.EventLoopGroup eventLoopGroup,
SdkChannelPool delegatePool,
List<ListenerInvokingChannelPool.ChannelPoolListener> listeners) |
ListenerInvokingChannelPool(Supplier<io.netty.util.concurrent.Promise<io.netty.channel.Channel>> promiseFactory,
SdkChannelPool delegatePool,
List<ListenerInvokingChannelPool.ChannelPoolListener> listeners) |
| Modifier and Type | Method and Description |
|---|---|
io.netty.util.concurrent.Future<io.netty.channel.Channel> |
acquire() |
io.netty.util.concurrent.Future<io.netty.channel.Channel> |
acquire(io.netty.util.concurrent.Promise<io.netty.channel.Channel> returnFuture) |
void |
close() |
CompletableFuture<Void> |
collectChannelPoolMetrics(MetricCollector metrics)
Collect channel pool metrics into the provided
MetricCollector collection, completing the returned future when
all metric publishing is complete. |
io.netty.util.concurrent.Future<Void> |
release(io.netty.channel.Channel channel) |
io.netty.util.concurrent.Future<Void> |
release(io.netty.channel.Channel channel,
io.netty.util.concurrent.Promise<Void> returnFuture) |
public ListenerInvokingChannelPool(io.netty.channel.EventLoopGroup eventLoopGroup,
SdkChannelPool delegatePool,
List<ListenerInvokingChannelPool.ChannelPoolListener> listeners)
public ListenerInvokingChannelPool(Supplier<io.netty.util.concurrent.Promise<io.netty.channel.Channel>> promiseFactory, SdkChannelPool delegatePool, List<ListenerInvokingChannelPool.ChannelPoolListener> listeners)
public io.netty.util.concurrent.Future<io.netty.channel.Channel> acquire()
acquire in interface io.netty.channel.pool.ChannelPoolpublic io.netty.util.concurrent.Future<io.netty.channel.Channel> acquire(io.netty.util.concurrent.Promise<io.netty.channel.Channel> returnFuture)
acquire in interface io.netty.channel.pool.ChannelPoolpublic io.netty.util.concurrent.Future<Void> release(io.netty.channel.Channel channel)
release in interface io.netty.channel.pool.ChannelPoolpublic io.netty.util.concurrent.Future<Void> release(io.netty.channel.Channel channel, io.netty.util.concurrent.Promise<Void> returnFuture)
release in interface io.netty.channel.pool.ChannelPoolpublic void close()
close in interface io.netty.channel.pool.ChannelPoolclose in interface Closeableclose in interface AutoCloseablepublic CompletableFuture<Void> collectChannelPoolMetrics(MetricCollector metrics)
SdkChannelPoolMetricCollector collection, completing the returned future when
all metric publishing is complete.collectChannelPoolMetrics in interface SdkChannelPoolmetrics - The collection to which all metrics should be added.Copyright © 2023. All rights reserved.