Class ShutdownableNioEventLoopGroup

  • All Implemented Interfaces:
    Shutdownable, io.netty.channel.EventLoopGroup, io.netty.util.concurrent.EventExecutorGroup, java.lang.Iterable<io.netty.util.concurrent.EventExecutor>, java.util.concurrent.Executor, java.util.concurrent.ExecutorService, java.util.concurrent.ScheduledExecutorService

    public class ShutdownableNioEventLoopGroup
    extends io.netty.channel.nio.NioEventLoopGroup
    implements Shutdownable
    • Constructor Summary

      Constructors 
      Constructor Description
      ShutdownableNioEventLoopGroup()
      Create a new instance using the default number of threads, the default ThreadFactory and the SelectorProvider which is returned by SelectorProvider.provider().
      ShutdownableNioEventLoopGroup​(int nThreads)
      Create a new instance using the specified number of threads, ThreadFactory and the SelectorProvider which is returned by SelectorProvider.provider().
      ShutdownableNioEventLoopGroup​(int nThreads, java.util.concurrent.Executor executor)  
      ShutdownableNioEventLoopGroup​(int nThreads, java.util.concurrent.Executor executor, io.netty.util.concurrent.EventExecutorChooserFactory chooserFactory, java.nio.channels.spi.SelectorProvider selectorProvider, io.netty.channel.SelectStrategyFactory selectStrategyFactory)  
      ShutdownableNioEventLoopGroup​(int nThreads, java.util.concurrent.Executor executor, io.netty.util.concurrent.EventExecutorChooserFactory chooserFactory, java.nio.channels.spi.SelectorProvider selectorProvider, io.netty.channel.SelectStrategyFactory selectStrategyFactory, io.netty.util.concurrent.RejectedExecutionHandler rejectedExecutionHandler)  
      ShutdownableNioEventLoopGroup​(int nThreads, java.util.concurrent.Executor executor, java.nio.channels.spi.SelectorProvider selectorProvider)  
      ShutdownableNioEventLoopGroup​(int nThreads, java.util.concurrent.Executor executor, java.nio.channels.spi.SelectorProvider selectorProvider, io.netty.channel.SelectStrategyFactory selectStrategyFactory)  
      ShutdownableNioEventLoopGroup​(int nThreads, java.util.concurrent.ThreadFactory threadFactory)
      Create a new instance using the specified number of threads, the given ThreadFactory and the SelectorProvider which is returned by SelectorProvider.provider().
      ShutdownableNioEventLoopGroup​(int nThreads, java.util.concurrent.ThreadFactory threadFactory, java.nio.channels.spi.SelectorProvider selectorProvider)
      Create a new instance using the specified number of threads, the given ThreadFactory and the given SelectorProvider.
      ShutdownableNioEventLoopGroup​(int nThreads, java.util.concurrent.ThreadFactory threadFactory, java.nio.channels.spi.SelectorProvider selectorProvider, io.netty.channel.SelectStrategyFactory selectStrategyFactory)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void waitForShutdown()
      Waits for shutdown to complete
      void waitForShutdown​(long timeoutInMs)
      Waits for shutdown to complete with a timeout
      • Methods inherited from class io.netty.channel.nio.NioEventLoopGroup

        newChild, rebuildSelectors, setIoRatio
      • Methods inherited from class io.netty.channel.MultithreadEventLoopGroup

        newDefaultThreadFactory, next, register, register, register
      • Methods inherited from class io.netty.util.concurrent.MultithreadEventExecutorGroup

        awaitTermination, executorCount, isShutdown, isShuttingDown, isTerminated, iterator, shutdown, shutdownGracefully, terminationFuture
      • Methods inherited from class io.netty.util.concurrent.AbstractEventExecutorGroup

        execute, invokeAll, invokeAll, invokeAny, invokeAny, schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelay, shutdownGracefully, shutdownNow, submit, submit, submit
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface io.netty.util.concurrent.EventExecutorGroup

        isShuttingDown, iterator, schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelay, shutdown, shutdownGracefully, shutdownGracefully, shutdownNow, submit, submit, submit, terminationFuture
      • Methods inherited from interface java.util.concurrent.Executor

        execute
      • Methods inherited from interface java.util.concurrent.ExecutorService

        awaitTermination, invokeAll, invokeAll, invokeAny, invokeAny, isShutdown, isTerminated
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Constructor Detail

      • ShutdownableNioEventLoopGroup

        public ShutdownableNioEventLoopGroup()
        Create a new instance using the default number of threads, the default ThreadFactory and the SelectorProvider which is returned by SelectorProvider.provider().
      • ShutdownableNioEventLoopGroup

        public ShutdownableNioEventLoopGroup​(int nThreads)
        Create a new instance using the specified number of threads, ThreadFactory and the SelectorProvider which is returned by SelectorProvider.provider().
        Parameters:
        nThreads -
      • ShutdownableNioEventLoopGroup

        public ShutdownableNioEventLoopGroup​(int nThreads,
                                             java.util.concurrent.ThreadFactory threadFactory)
        Create a new instance using the specified number of threads, the given ThreadFactory and the SelectorProvider which is returned by SelectorProvider.provider().
        Parameters:
        nThreads -
        threadFactory -
      • ShutdownableNioEventLoopGroup

        public ShutdownableNioEventLoopGroup​(int nThreads,
                                             java.util.concurrent.Executor executor)
      • ShutdownableNioEventLoopGroup

        public ShutdownableNioEventLoopGroup​(int nThreads,
                                             java.util.concurrent.ThreadFactory threadFactory,
                                             java.nio.channels.spi.SelectorProvider selectorProvider)
        Create a new instance using the specified number of threads, the given ThreadFactory and the given SelectorProvider.
        Parameters:
        nThreads -
        threadFactory -
        selectorProvider -
      • ShutdownableNioEventLoopGroup

        public ShutdownableNioEventLoopGroup​(int nThreads,
                                             java.util.concurrent.ThreadFactory threadFactory,
                                             java.nio.channels.spi.SelectorProvider selectorProvider,
                                             io.netty.channel.SelectStrategyFactory selectStrategyFactory)
      • ShutdownableNioEventLoopGroup

        public ShutdownableNioEventLoopGroup​(int nThreads,
                                             java.util.concurrent.Executor executor,
                                             java.nio.channels.spi.SelectorProvider selectorProvider)
      • ShutdownableNioEventLoopGroup

        public ShutdownableNioEventLoopGroup​(int nThreads,
                                             java.util.concurrent.Executor executor,
                                             java.nio.channels.spi.SelectorProvider selectorProvider,
                                             io.netty.channel.SelectStrategyFactory selectStrategyFactory)
      • ShutdownableNioEventLoopGroup

        public ShutdownableNioEventLoopGroup​(int nThreads,
                                             java.util.concurrent.Executor executor,
                                             io.netty.util.concurrent.EventExecutorChooserFactory chooserFactory,
                                             java.nio.channels.spi.SelectorProvider selectorProvider,
                                             io.netty.channel.SelectStrategyFactory selectStrategyFactory)
      • ShutdownableNioEventLoopGroup

        public ShutdownableNioEventLoopGroup​(int nThreads,
                                             java.util.concurrent.Executor executor,
                                             io.netty.util.concurrent.EventExecutorChooserFactory chooserFactory,
                                             java.nio.channels.spi.SelectorProvider selectorProvider,
                                             io.netty.channel.SelectStrategyFactory selectStrategyFactory,
                                             io.netty.util.concurrent.RejectedExecutionHandler rejectedExecutionHandler)
    • Method Detail

      • waitForShutdown

        public void waitForShutdown()
                             throws java.lang.InterruptedException,
                                    java.lang.IllegalStateException
        Waits for shutdown to complete
        Specified by:
        waitForShutdown in interface Shutdownable
        Throws:
        java.lang.InterruptedException - when the wait is interrupted
        java.lang.IllegalStateException - when the method is invoked when the shutdown has yet to be started
      • waitForShutdown

        public void waitForShutdown​(long timeoutInMs)
                             throws java.lang.InterruptedException,
                                    java.lang.IllegalStateException,
                                    java.util.concurrent.TimeoutException
        Waits for shutdown to complete with a timeout
        Specified by:
        waitForShutdown in interface Shutdownable
        Parameters:
        timeoutInMs - number of milliseconds to wait before throwing TimeoutException
        Throws:
        java.lang.InterruptedException - when the wait is interrupted
        java.lang.IllegalStateException - when the method is invoked when the shutdown has yet to be started
        java.util.concurrent.TimeoutException - when the operation times out