Class ListenerInvokingChannelPool
- java.lang.Object
-
- software.amazon.awssdk.http.nio.netty.internal.ListenerInvokingChannelPool
-
- All Implemented Interfaces:
io.netty.channel.pool.ChannelPool,Closeable,AutoCloseable,SdkChannelPool
public final class ListenerInvokingChannelPool extends Object implements SdkChannelPool
ASdkChannelPoolthat wraps and delegates to anotherSdkChannelPoolwhile invokingListenerInvokingChannelPool.ChannelPoolListeners for important events that occur.ListenerInvokingChannelPool.ChannelPoolListeneris similar to Netty'sChannelPoolHandlerinterface, but by invoking them as part of aSdkChannelPoolwrapper, we are given more control over when they are invoked. For example,HttpOrHttp2ChannelPoolmay 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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceListenerInvokingChannelPool.ChannelPoolListenerListener which is called for various actions performed on aSdkChannelPool.
-
Constructor Summary
Constructors Constructor 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)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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)voidclose()CompletableFuture<Void>collectChannelPoolMetrics(MetricCollector metrics)Collect channel pool metrics into the providedMetricCollectorcollection, 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)
-
-
-
Constructor Detail
-
ListenerInvokingChannelPool
public ListenerInvokingChannelPool(io.netty.channel.EventLoopGroup eventLoopGroup, SdkChannelPool delegatePool, List<ListenerInvokingChannelPool.ChannelPoolListener> listeners)
-
ListenerInvokingChannelPool
public ListenerInvokingChannelPool(Supplier<io.netty.util.concurrent.Promise<io.netty.channel.Channel>> promiseFactory, SdkChannelPool delegatePool, List<ListenerInvokingChannelPool.ChannelPoolListener> listeners)
-
-
Method Detail
-
acquire
public io.netty.util.concurrent.Future<io.netty.channel.Channel> acquire()
- Specified by:
acquirein interfaceio.netty.channel.pool.ChannelPool
-
acquire
public io.netty.util.concurrent.Future<io.netty.channel.Channel> acquire(io.netty.util.concurrent.Promise<io.netty.channel.Channel> returnFuture)
- Specified by:
acquirein interfaceio.netty.channel.pool.ChannelPool
-
release
public io.netty.util.concurrent.Future<Void> release(io.netty.channel.Channel channel)
- Specified by:
releasein interfaceio.netty.channel.pool.ChannelPool
-
release
public io.netty.util.concurrent.Future<Void> release(io.netty.channel.Channel channel, io.netty.util.concurrent.Promise<Void> returnFuture)
- Specified by:
releasein interfaceio.netty.channel.pool.ChannelPool
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceio.netty.channel.pool.ChannelPool- Specified by:
closein interfaceCloseable
-
collectChannelPoolMetrics
public CompletableFuture<Void> collectChannelPoolMetrics(MetricCollector metrics)
Description copied from interface:SdkChannelPoolCollect channel pool metrics into the providedMetricCollectorcollection, completing the returned future when all metric publishing is complete.- Specified by:
collectChannelPoolMetricsin interfaceSdkChannelPool- Parameters:
metrics- The collection to which all metrics should be added.- Returns:
- A future that is completed when all metric publishing is complete.
-
-