Class StatefulNettyTransport

  • All Implemented Interfaces:
    Transport

    class StatefulNettyTransport
    extends Object
    implements Transport
    Creates netty connections with configured event loops. This implementation reuses the same event loops for each connection created. Event loop groups are not shutdown when the connection closed, they can be shared between multiple connections. shutdownOnClose controls whether event loop groups are shutdown when the transport is closed.
    • Field Detail

      • logger

        protected final Logger logger
        Logger for this class.
      • channelType

        private final Class<? extends io.netty.channel.Channel> channelType
        Channel type.
      • ioWorkerGroup

        private final io.netty.channel.EventLoopGroup ioWorkerGroup
        Event loop group for I/O, must support the channel type.
      • messageWorkerGroup

        private final io.netty.channel.EventLoopGroup messageWorkerGroup
        Event loop group for message handling.
      • shutdownOnClose

        private final boolean shutdownOnClose
        Whether to shut down the event loop groups on close().
    • Constructor Detail

      • StatefulNettyTransport

        StatefulNettyTransport()
        Creates a new stateful netty transport.
      • StatefulNettyTransport

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

        StatefulNettyTransport​(int ioThreads,
                               int messageThreads)
        Creates a new stateful 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
      • StatefulNettyTransport

        StatefulNettyTransport​(String name,
                               int ioThreads,
                               int messageThreads,
                               boolean shutdown)
        Creates a new stateful netty transport.
        Parameters:
        name - to assign 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
        shutdown - whether to shut down the event loop groups on close
      • StatefulNettyTransport

        StatefulNettyTransport​(Class<? extends io.netty.channel.Channel> type,
                               io.netty.channel.EventLoopGroup ioGroup,
                               io.netty.channel.EventLoopGroup messageGroup,
                               boolean shutdown)
        Creates a new netty connection factory transport.
        Parameters:
        type - of channel
        ioGroup - event loop group to handle I/O
        messageGroup - event loop group to handle inbound messages, can be null
        shutdown - whether to shut down the event loop groups on close
    • Method Detail

      • 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
      • getShutdownOnClose

        boolean getShutdownOnClose()
        Returns whether thread pools will be shutdown on close.
        Returns:
        whether thread pools will be shutdown on close