Class NettyConnectionFactoryTransport

java.lang.Object
org.ldaptive.transport.netty.NettyConnectionFactoryTransport
All Implemented Interfaces:
Transport
Direct Known Subclasses:
ConnectionFactoryTransport, NioConnectionFactoryTransport, NioSingletonTransport, SingletonTransport

public class NettyConnectionFactoryTransport extends Object implements Transport
Creates netty connections with configured event loops. This implementation reuses the same event loops for each connection created.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final Class<? extends io.netty.channel.Channel>
    Channel type.
    private final io.netty.channel.EventLoopGroup
    Event loop group for I/O, must support the channel type.
    protected final org.slf4j.Logger
    Logger for this class.
    private final io.netty.channel.EventLoopGroup
    Event loop group for message handling.
    private boolean
    Whether to shutdown the event loop groups on close().
  • Constructor Summary

    Constructors
    Constructor
    Description
    NettyConnectionFactoryTransport(Class<? extends io.netty.channel.Channel> type, io.netty.channel.EventLoopGroup ioGroup)
    Creates a new netty connection factory transport.
    NettyConnectionFactoryTransport(Class<? extends io.netty.channel.Channel> type, io.netty.channel.EventLoopGroup ioGroup, io.netty.channel.EventLoopGroup messageGroup)
    Creates a new netty connection factory transport.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Free any resources associated with this transport.
    Create a connection object.
    void
    setShutdownOnClose(boolean b)
    Sets whether to shutdown the event loop groups on close.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • logger

      protected final org.slf4j.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 boolean shutdownOnClose
      Whether to shutdown the event loop groups on close().
  • Constructor Details

    • NettyConnectionFactoryTransport

      public NettyConnectionFactoryTransport(Class<? extends io.netty.channel.Channel> type, io.netty.channel.EventLoopGroup ioGroup)
      Creates a new netty connection factory transport.
      Parameters:
      type - of channel
      ioGroup - event loop group to handle I/O
    • NettyConnectionFactoryTransport

      public NettyConnectionFactoryTransport(Class<? extends io.netty.channel.Channel> type, io.netty.channel.EventLoopGroup ioGroup, io.netty.channel.EventLoopGroup messageGroup)
      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
  • Method Details

    • setShutdownOnClose

      public void setShutdownOnClose(boolean b)
      Sets whether to shutdown the event loop groups on close.
      Parameters:
      b - whether to shutdown on close
    • 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.
      Specified by:
      close in interface Transport
    • toString

      public String toString()
      Overrides:
      toString in class Object