java.lang.Object
org.neo4j.bolt.connection.netty.impl.async.connection.EventLoopGroupFactory

public final class EventLoopGroupFactory extends Object
Manages creation of Netty EventLoopGroups, which are basically Executors that perform IO operations.
  • Constructor Details

    • EventLoopGroupFactory

      public EventLoopGroupFactory(String threadNamePrefix, NettyTransport nettyTransport)
  • Method Details

    • nettyTransport

      public NettyTransport nettyTransport()
    • newEventLoopGroup

      public io.netty.channel.EventLoopGroup newEventLoopGroup(int threadCount)
    • assertNotInEventLoopThread

      public static void assertNotInEventLoopThread() throws IllegalStateException
      Assert that current thread is not an event loop used for async IO operations. This check is needed because blocking API methods are implemented on top of corresponding async API methods. Deadlocks might happen when IO thread executes blocking API call and has to wait for itself to read from the network.
      Throws:
      IllegalStateException - when current thread is an event loop IO thread.
    • isEventLoopThread

      public static boolean isEventLoopThread(Thread thread)
      Check if given thread is an event loop IO thread.
      Parameters:
      thread - the thread to check.
      Returns:
      true when given thread belongs to the event loop, false otherwise.