Class NettyUtils


  • public final class NettyUtils
    extends java.lang.Object
    Provides utility methods for this package.
    Author:
    Middleware Services
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static io.netty.channel.EventLoopGroup createDefaultEventLoopGroup​(java.lang.String name, int numThreads)
      Returns the default event loop group for this platform.
      static java.lang.Class<? extends io.netty.channel.Channel> getDefaultSocketChannelType()
      Returns the default socket channel type for this platform.
      static void shutdownGracefully​(io.netty.channel.EventLoopGroup workerGroup)
      Invokes EventExecutorGroup.shutdownGracefully(long, long, TimeUnit) on the supplied worker group.
      • Methods inherited from class java.lang.Object

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

      • getDefaultSocketChannelType

        public static java.lang.Class<? extends io.netty.channel.Channel> getDefaultSocketChannelType()
        Returns the default socket channel type for this platform. See Epoll.isAvailable() and KQueue.isAvailable().
        Returns:
        socket channel type
      • createDefaultEventLoopGroup

        public static io.netty.channel.EventLoopGroup createDefaultEventLoopGroup​(java.lang.String name,
                                                                                  int numThreads)
        Returns the default event loop group for this platform. See Epoll.isAvailable() and KQueue.isAvailable(). Set numThreads to zero to use the netty default.
        Parameters:
        name - of the thread pool
        numThreads - number of threads in the thread pool
        Returns:
        event loop group
      • shutdownGracefully

        public static void shutdownGracefully​(io.netty.channel.EventLoopGroup workerGroup)
        Invokes EventExecutorGroup.shutdownGracefully(long, long, TimeUnit) on the supplied worker group. This method blocks for twice the DEFAULT_SHUTDOWN_MAX_TIMEOUT waiting for the shutdown to be done. If the future is not invoked in that timeframe a warning is logged.
        Parameters:
        workerGroup - to shutdown