Class FixedChannelPoolFactory

  • All Implemented Interfaces:
    ChannelPoolFactory, io.netty.channel.pool.ChannelHealthChecker

    public class FixedChannelPoolFactory
    extends java.lang.Object
    implements ChannelPoolFactory, io.netty.channel.pool.ChannelHealthChecker
    This factory constructs instances of FixedChannelPool for the ChannelPoolManager.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.function.BooleanSupplier _useQueueSizeForAcquiredChannelCount  
      protected boolean _usingFastPool  
      • Fields inherited from interface io.netty.channel.pool.ChannelHealthChecker

        ACTIVE
    • Constructor Summary

      Constructors 
      Constructor Description
      FixedChannelPoolFactory​(io.netty.bootstrap.Bootstrap bootstrap, long acquireTimeoutMillis, int maxConnections, int maxPendingAcquires, boolean releaseHeathCheck, long healthCheckIntervalMillis, io.netty.channel.pool.ChannelHealthChecker channelHealthChecker, CallTracker healthCheckerTracker)  
      FixedChannelPoolFactory​(io.netty.bootstrap.Bootstrap bootstrap, long acquireTimeoutMillis, int maxConnections, int maxPendingAcquires, boolean releaseHeathCheck, long healthCheckIntervalMillis, io.netty.channel.pool.ChannelHealthChecker channelHealthChecker, java.util.function.Function<java.net.SocketAddress,​CallTracker> healthCheckerTracker)  
      FixedChannelPoolFactory​(io.netty.bootstrap.Bootstrap bootstrap, long acquireTimeoutMillis, int minConnections, int maxConnections, int maxPendingAcquires, boolean releaseHeathCheck, long healthCheckIntervalMillis, io.netty.channel.pool.ChannelHealthChecker channelHealthChecker, java.util.function.Function<java.net.SocketAddress,​CallTracker> healthCheckerTracker)  
      FixedChannelPoolFactory​(io.netty.bootstrap.Bootstrap bootstrap, long acquireTimeoutMillis, java.util.function.IntSupplier minConnections, java.util.function.IntSupplier maxConnections, java.util.function.IntSupplier maxPendingAcquires, boolean releaseHeathCheck, java.util.function.LongSupplier healthCheckIntervalMillis, io.netty.channel.pool.ChannelHealthChecker channelHealthChecker, java.util.function.Function<java.net.SocketAddress,​CallTracker> healthCheckerTracker)  
    • Field Detail

      • _usingFastPool

        protected boolean _usingFastPool
      • _useQueueSizeForAcquiredChannelCount

        protected java.util.function.BooleanSupplier _useQueueSizeForAcquiredChannelCount
    • Constructor Detail

      • FixedChannelPoolFactory

        public FixedChannelPoolFactory​(@Nonnull
                                       io.netty.bootstrap.Bootstrap bootstrap,
                                       @Nonnegative
                                       long acquireTimeoutMillis,
                                       @Nonnegative
                                       int maxConnections,
                                       @Nonnegative
                                       int maxPendingAcquires,
                                       boolean releaseHeathCheck,
                                       @Nonnegative
                                       long healthCheckIntervalMillis,
                                       @Nonnull
                                       io.netty.channel.pool.ChannelHealthChecker channelHealthChecker,
                                       @Nullable
                                       CallTracker healthCheckerTracker)
      • FixedChannelPoolFactory

        public FixedChannelPoolFactory​(@Nonnull
                                       io.netty.bootstrap.Bootstrap bootstrap,
                                       @Nonnegative
                                       long acquireTimeoutMillis,
                                       @Nonnegative
                                       int maxConnections,
                                       @Nonnegative
                                       int maxPendingAcquires,
                                       boolean releaseHeathCheck,
                                       @Nonnegative
                                       long healthCheckIntervalMillis,
                                       @Nonnull
                                       io.netty.channel.pool.ChannelHealthChecker channelHealthChecker,
                                       @Nullable
                                       java.util.function.Function<java.net.SocketAddress,​CallTracker> healthCheckerTracker)
      • FixedChannelPoolFactory

        public FixedChannelPoolFactory​(@Nonnull
                                       io.netty.bootstrap.Bootstrap bootstrap,
                                       @Nonnegative
                                       long acquireTimeoutMillis,
                                       @Nonnegative
                                       int minConnections,
                                       @Nonnegative
                                       int maxConnections,
                                       @Nonnegative
                                       int maxPendingAcquires,
                                       boolean releaseHeathCheck,
                                       @Nonnegative
                                       long healthCheckIntervalMillis,
                                       @Nonnull
                                       io.netty.channel.pool.ChannelHealthChecker channelHealthChecker,
                                       @Nullable
                                       java.util.function.Function<java.net.SocketAddress,​CallTracker> healthCheckerTracker)
      • FixedChannelPoolFactory

        public FixedChannelPoolFactory​(@Nonnull
                                       io.netty.bootstrap.Bootstrap bootstrap,
                                       @Nonnegative
                                       long acquireTimeoutMillis,
                                       @Nonnull
                                       java.util.function.IntSupplier minConnections,
                                       @Nonnull
                                       java.util.function.IntSupplier maxConnections,
                                       @Nonnull
                                       java.util.function.IntSupplier maxPendingAcquires,
                                       boolean releaseHeathCheck,
                                       @Nonnull
                                       java.util.function.LongSupplier healthCheckIntervalMillis,
                                       @Nonnull
                                       io.netty.channel.pool.ChannelHealthChecker channelHealthChecker,
                                       @Nullable
                                       java.util.function.Function<java.net.SocketAddress,​CallTracker> healthCheckerTracker)
    • Method Detail

      • getChannelPoolHandler

        protected static <T extends io.netty.channel.pool.ChannelPoolHandler> T getChannelPoolHandler​(@Nonnull
                                                                                                      io.netty.channel.Channel ch)
      • setUsingFastPool

        public void setUsingFastPool​(boolean usingFastPool)
      • isUsingFastPool

        public boolean isUsingFastPool()
      • setUseQueueSizeForAcquiredChannelCount

        public void setUseQueueSizeForAcquiredChannelCount​(@Nonnull
                                                           java.util.function.BooleanSupplier useQueueSizeForAcquiredChannelCount)
      • setMinConnections

        public void setMinConnections​(@Nonnegative
                                      int minConnections)
      • setAcquireTimeoutAction

        public void setAcquireTimeoutAction​(@Nonnull
                                            io.netty.channel.pool.FixedChannelPool.AcquireTimeoutAction action)
      • setMinConnections

        public void setMinConnections​(@Nonnull
                                      java.util.function.IntSupplier minConnections)
      • getMinConnections

        public int getMinConnections()
      • getMaxConnections

        public int getMaxConnections()
      • getMaxPendingAcquires

        public int getMaxPendingAcquires()
      • getAcquireTimeoutMillis

        public long getAcquireTimeoutMillis()
      • construct

        @Nonnull
        public ManagedChannelPool construct​(@Nonnull
                                            ChannelPoolManager manager,
                                            @Nonnull
                                            io.netty.channel.pool.ChannelPoolHandler handler,
                                            @Nonnull
                                            io.netty.channel.EventLoopGroup eventLoop,
                                            @Nonnull
                                            java.net.InetSocketAddress address)
        Description copied from interface: ChannelPoolFactory
        Constructs a new ChannelPool which must connect to the specified address.
        Specified by:
        construct in interface ChannelPoolFactory
        Parameters:
        manager - The channel pool manager which will manage the pool.
        handler - A handler to be notified of events.
        eventLoop - The eventloop for the connection pool.
        address - Target address/port for the connection pool.
        Returns:
        New instance of ManagedChannelPool
      • construct

        @Nonnull
        protected ManagedChannelPool construct​(@Nonnull
                                               io.netty.bootstrap.Bootstrap bootstrap,
                                               @Nonnull
                                               io.netty.channel.pool.ChannelPoolHandler channelPoolHandler,
                                               @Nonnull
                                               io.netty.channel.pool.ChannelHealthChecker healthChecker,
                                               @Nonnull
                                               io.netty.channel.pool.FixedChannelPool.AcquireTimeoutAction acquireTimeoutAction,
                                               @Nonnull
                                               java.util.function.IntSupplier minConnections,
                                               int maxConnections,
                                               boolean releaseHeathCheck)
      • setHealthCheckIntervalMillis

        public void setHealthCheckIntervalMillis​(@Nonnegative
                                                 long healthCheckIntervalMillis)
      • setHealthCheckIntervalMillis

        public void setHealthCheckIntervalMillis​(@Nonnull
                                                 java.util.function.LongSupplier healthCheckIntervalMillis)
      • getHealthCheckIntervalMillis

        public long getHealthCheckIntervalMillis()
      • isHealthy

        public io.netty.util.concurrent.Future<java.lang.Boolean> isHealthy​(io.netty.channel.Channel channel)
        Specified by:
        isHealthy in interface io.netty.channel.pool.ChannelHealthChecker