Class SimpleChannelPoolManagerImpl

  • All Implemented Interfaces:
    ChannelPoolManager

    public class SimpleChannelPoolManagerImpl
    extends java.lang.Object
    implements ChannelPoolManager
    In order to simplify the implementation of this ChannelPoolManager, this implementation requires that open(String) is called to create the hostNameAndPort instead of lazily creating them upon first reference. In the case for Espresso Router, it is informed of all the valid hostNameAndPort from Helix and should then call open(String) for each host. Calling it for a host that is already existant is a no-operation.
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      io.netty.util.concurrent.Future<io.netty.channel.Channel> acquire​(io.netty.channel.EventLoop eventLoop, java.lang.String hostNameAndPort, java.lang.String queueName, QOS qos)
      Acquire a channel from the pool.
      io.netty.util.concurrent.Future<io.netty.channel.Channel> acquire​(java.lang.String hostNameAndPort, java.lang.String queueName, QOS qos)
      Acquire a channel from the pool.
      io.netty.util.concurrent.Future<java.lang.Void> close​(java.lang.String hostNameAndPort)
      Close the connection pool to the specified host and port.
      protected ManagedChannelPool constructManagedPool​(io.netty.channel.pool.ChannelPoolHandler poolHandler, java.net.InetSocketAddress address)  
      protected CallTracker createHostAcquireCallTracker​(java.lang.String hostAndPort)  
      protected CallTracker createHostBusyCallTracker​(java.lang.String hostAndPort)  
      int executorCount()
      Deprecated.
      io.netty.util.concurrent.Future<java.lang.Void> open​(java.lang.String hostNameAndPort)
      Open the connection pool to the specified host and port.
      io.netty.util.concurrent.Future<java.lang.Void> release​(io.netty.channel.Channel channel)
      Release the channel to the pool.
      int subpoolCount()
      The number of subpool threads used per pool by this class.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SimpleChannelPoolManagerImpl

        public SimpleChannelPoolManagerImpl​(@Nonnull
                                            E eventLoopGroup,
                                            @Nonnull
                                            ChannelPoolFactory channelPoolFactory)
    • Method Detail

      • constructManagedPool

        protected ManagedChannelPool constructManagedPool​(io.netty.channel.pool.ChannelPoolHandler poolHandler,
                                                          java.net.InetSocketAddress address)
      • createHostAcquireCallTracker

        @Nonnull
        protected CallTracker createHostAcquireCallTracker​(@Nonnull
                                                           java.lang.String hostAndPort)
      • createHostBusyCallTracker

        @Nonnull
        protected CallTracker createHostBusyCallTracker​(@Nonnull
                                                        java.lang.String hostAndPort)
      • executorCount

        @Deprecated
        public int executorCount()
        Deprecated.
        Description copied from interface: ChannelPoolManager
        The number of threads in the eventloopgroup used by this class.
        Specified by:
        executorCount in interface ChannelPoolManager
        Returns:
        thread count
      • subpoolCount

        public int subpoolCount()
        Description copied from interface: ChannelPoolManager
        The number of subpool threads used per pool by this class. Must be less than or equal to the number of threads in the eventloopgroup. Must be greater than zero.
        Specified by:
        subpoolCount in interface ChannelPoolManager
        Returns:
        thread count
      • acquire

        @Nonnull
        public io.netty.util.concurrent.Future<io.netty.channel.Channel> acquire​(@Nonnull
                                                                                 java.lang.String hostNameAndPort,
                                                                                 @Nonnull
                                                                                 java.lang.String queueName,
                                                                                 @Nonnull
                                                                                 QOS qos)
        Description copied from interface: ChannelPoolManager
        Acquire a channel from the pool.
        Specified by:
        acquire in interface ChannelPoolManager
        Parameters:
        hostNameAndPort - host name and port
        queueName - queue name
        qos - priority
        Returns:
        future for acquired channel
      • acquire

        @Nonnull
        public io.netty.util.concurrent.Future<io.netty.channel.Channel> acquire​(@Nonnull
                                                                                 io.netty.channel.EventLoop eventLoop,
                                                                                 @Nonnull
                                                                                 java.lang.String hostNameAndPort,
                                                                                 @Nonnull
                                                                                 java.lang.String queueName,
                                                                                 @Nonnull
                                                                                 QOS qos)
        Description copied from interface: ChannelPoolManager
        Acquire a channel from the pool.
        Specified by:
        acquire in interface ChannelPoolManager
        hostNameAndPort - host name and port
        queueName - queue name
        qos - priority
        Returns:
        future for acquired channel
      • release

        @Nonnull
        public io.netty.util.concurrent.Future<java.lang.Void> release​(@Nonnull
                                                                       io.netty.channel.Channel channel)
        Description copied from interface: ChannelPoolManager
        Release the channel to the pool.
        Specified by:
        release in interface ChannelPoolManager
        Parameters:
        channel - channel
        Returns:
        future which is completed when done
      • open

        public io.netty.util.concurrent.Future<java.lang.Void> open​(@Nonnull
                                                                    java.lang.String hostNameAndPort)
        Description copied from interface: ChannelPoolManager
        Open the connection pool to the specified host and port. The default implementation simply acquires a channel from the pool and then immediately releases it.
        Specified by:
        open in interface ChannelPoolManager
        Parameters:
        hostNameAndPort - Host and port string
        Returns:
        future which is completed when done
      • close

        @Nonnull
        public io.netty.util.concurrent.Future<java.lang.Void> close​(@Nonnull
                                                                     java.lang.String hostNameAndPort)
        Description copied from interface: ChannelPoolManager
        Close the connection pool to the specified host and port.
        Specified by:
        close in interface ChannelPoolManager
        Parameters:
        hostNameAndPort - Host and port string
        Returns:
        future which is completed when done