Class Http2AwareChannelPool

  • All Implemented Interfaces:
    ChannelPoolWithStats, ManagedChannelPool, io.netty.channel.pool.ChannelPool, java.io.Closeable, java.lang.AutoCloseable

    public class Http2AwareChannelPool
    extends java.lang.Object
    implements ManagedChannelPool
    A ChannelPool Wrapper that would return either a ChannelPool if the request is an HTTP 1.1 request or A Stream if HTTP2
    • Field Detail

      • HTTP2_STREAM_CHANNEL_AVAILABLE_FOR_REUSE

        public static final io.netty.util.AttributeKey<java.lang.Boolean> HTTP2_STREAM_CHANNEL_AVAILABLE_FOR_REUSE
      • HTTP2_REUSED_STREAM_CHANNEL

        public static final io.netty.util.AttributeKey<java.lang.Boolean> HTTP2_REUSED_STREAM_CHANNEL
      • HTTP2_CONNECTION

        public static final io.netty.util.AttributeKey<io.netty.handler.codec.http2.Http2Connection> HTTP2_CONNECTION
      • DEFAULT_MAX_REUSE_STREAM_CHANNELS_LIMIT

        public static final int DEFAULT_MAX_REUSE_STREAM_CHANNELS_LIMIT
        See Also:
        Constant Field Values
      • DEFAULT_MAX_CONCURRENT_STREAMS

        public static final int DEFAULT_MAX_CONCURRENT_STREAMS
        See Also:
        Constant Field Values
    • Constructor Detail

      • Http2AwareChannelPool

        public Http2AwareChannelPool​(ManagedChannelPool parentPool,
                                     java.util.function.Consumer<io.netty.channel.Channel> preStreamChannelInitializer,
                                     java.util.function.Consumer<io.netty.channel.Channel> postStreamInitializer)
      • Http2AwareChannelPool

        public Http2AwareChannelPool​(ManagedChannelPool parentPool,
                                     java.util.function.Consumer<io.netty.channel.Channel> preStreamChannelInitializer,
                                     java.util.function.Consumer<io.netty.channel.Channel> postStreamInitializer,
                                     boolean moreThanOneHttp2Connection)
      • Http2AwareChannelPool

        public Http2AwareChannelPool​(ManagedChannelPool parentPool,
                                     java.util.function.Consumer<io.netty.channel.Channel> preStreamChannelInitializer,
                                     java.util.function.Consumer<io.netty.channel.Channel> postStreamInitializer,
                                     boolean moreThanOneHttp2Connection,
                                     io.netty.channel.group.ChannelGroup http2ChannelGroup)
    • Method Detail

      • setMaxConcurrentStreams

        public void setMaxConcurrentStreams​(long maxConcurrentStreams)
      • getMaxConcurrentStreamsLimit

        public long getMaxConcurrentStreamsLimit()
      • setMoreThanOneHttp2Connection

        public void setMoreThanOneHttp2Connection​(boolean value)
      • setChannelReuse

        public void setChannelReuse​(boolean channelReuse)
      • wantMoreThanOneHttp2Connection

        public boolean wantMoreThanOneHttp2Connection()
      • hasMoreThanOneHttp2Connection

        public boolean hasMoreThanOneHttp2Connection()
      • useCustomH2Codec

        public boolean useCustomH2Codec()
      • setUseCustomH2Codec

        public void setUseCustomH2Codec​(boolean useCustomH2Codec)
      • setMaxReuseStreamChannelsLimit

        public void setMaxReuseStreamChannelsLimit​(int maxReuseStreamChannelsLimit)
      • getMaxReuseStreamChannelsLimit

        public int getMaxReuseStreamChannelsLimit()
      • setRetryOnMaxStreamsLimit

        public void setRetryOnMaxStreamsLimit​(boolean retryOnMaxStreamsLimit)
      • shouldRetryOnMaxStreamsLimit

        public boolean shouldRetryOnMaxStreamsLimit()
      • acquire

        public io.netty.util.concurrent.Future<io.netty.channel.Channel> acquire()
        Specified by:
        acquire in interface io.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> promise)
        Specified by:
        acquire in interface io.netty.channel.pool.ChannelPool
      • acquire0

        protected io.netty.util.concurrent.Promise<io.netty.channel.Channel> acquire0​(io.netty.util.concurrent.Promise<io.netty.channel.Channel> promise)
      • isTooManyActiveStreamsError

        @Deprecated
        public static boolean isTooManyActiveStreamsError​(java.lang.Throwable t)
        Deprecated.
      • release

        public io.netty.util.concurrent.Future<java.lang.Void> release​(io.netty.channel.Channel channel)
        Specified by:
        release in interface io.netty.channel.pool.ChannelPool
      • release

        public io.netty.util.concurrent.Future<java.lang.Void> release​(io.netty.channel.Channel channel,
                                                                       io.netty.util.concurrent.Promise<java.lang.Void> promise)
        Specified by:
        release in interface io.netty.channel.pool.ChannelPool
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface io.netty.channel.pool.ChannelPool
        Specified by:
        close in interface java.io.Closeable
      • handler

        public io.netty.channel.pool.ChannelPoolHandler handler()
        Description copied from interface: ManagedChannelPool
        Returns the ChannelPoolHandler that will be notified for the different pool actions.
        Specified by:
        handler in interface ManagedChannelPool
        Returns:
        the ChannelPoolHandler that will be notified for the different pool actions
      • closeFuture

        public final io.netty.util.concurrent.Future<java.lang.Void> closeFuture()
        Specified by:
        closeFuture in interface ManagedChannelPool
      • getChannelReusePoolSize

        public long getChannelReusePoolSize()
        Description copied from interface: ManagedChannelPool
        Returns the current reuse channel pool size. Normally this should be 0 since we should be reusing as much as possible.
        Specified by:
        getChannelReusePoolSize in interface ManagedChannelPool
        Returns:
        current reuse channel pool size