Class DefaultNettyTransport

  • All Implemented Interfaces:
    Transport

    class DefaultNettyTransport
    extends Object
    implements Transport
    Creates netty connections using the best fit event loop group based on the operating system. See Epoll.isAvailable() and KQueue.isAvailable(). New event loop groups are created for every connection. The event loop groups are shutdown when the connection is closed.
    • Field Detail

      • logger

        protected final Logger logger
        Logger for this class.
      • threadPoolName

        private final String threadPoolName
        Name of the event loop group.
      • numIoThreads

        private final int numIoThreads
        Number of I/O threads.
      • numMessageThreads

        private final int numMessageThreads
        Number of message threads.
    • Constructor Detail

      • DefaultNettyTransport

        DefaultNettyTransport()
        Creates a new default netty transport.
      • DefaultNettyTransport

        DefaultNettyTransport​(int ioThreads)
        Creates a new default netty transport.
        Parameters:
        ioThreads - number of threads used for I/O in the event loop group
      • DefaultNettyTransport

        DefaultNettyTransport​(int ioThreads,
                              int messageThreads)
        Creates a new default netty transport.
        Parameters:
        ioThreads - number of threads used for I/O in the event loop group
        messageThreads - number of threads for LDAP message handling in the event loop group
      • DefaultNettyTransport

        DefaultNettyTransport​(String name,
                              int ioThreads,
                              int messageThreads)
        Creates a new default netty transport.
        Parameters:
        name - of the thread pool
        ioThreads - number of threads used for I/O in the event loop group
        messageThreads - number of threads for LDAP message handling in the event loop group
    • Method Detail

      • getSocketChannelType

        protected Class<? extends io.netty.channel.Channel> getSocketChannelType()
        Returns the socket channel type used with the event loop group.
        Returns:
        socket channel type
      • createEventLoopGroup

        protected io.netty.channel.EventLoopGroup createEventLoopGroup​(String name,
                                                                       int numThreads)
        Returns a new event loop group with the supplied name and number of threads.
        Parameters:
        name - of the event loop group
        numThreads - number of worker threads
        Returns:
        new event loop group
      • create

        public Connection create​(ConnectionConfig cc)
        Description copied from interface: Transport
        Create a connection object. Implementations should not open a TCP socket in this method.
        Specified by:
        create in interface Transport
        Parameters:
        cc - connection configuration
        Returns:
        connection
      • close

        public void close()
        Description copied from interface: Transport
        Free any resources associated with this transport. This method is invoked by the connection factory using this transport.
        Specified by:
        close in interface Transport