Class ShutdownableEventLoopGroup<E extends io.netty.channel.EventLoopGroup>

  • 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 ShutdownableEventLoopGroup<E extends io.netty.channel.EventLoopGroup>
    extends java.lang.Object
    implements io.netty.channel.EventLoopGroup, Shutdownable
    Created by acurtis on 3/30/17.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean awaitTermination​(long timeout, java.util.concurrent.TimeUnit unit)  
      E eventLoopGroup()  
      void execute​(java.lang.Runnable command)  
      <T> java.util.List<java.util.concurrent.Future<T>> invokeAll​(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks)  
      <T> java.util.List<java.util.concurrent.Future<T>> invokeAll​(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks, long timeout, java.util.concurrent.TimeUnit unit)  
      <T> T invokeAny​(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks)  
      <T> T invokeAny​(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks, long timeout, java.util.concurrent.TimeUnit unit)  
      boolean isShutdown()  
      boolean isShuttingDown()  
      boolean isTerminated()  
      java.util.Iterator<io.netty.util.concurrent.EventExecutor> iterator()  
      io.netty.channel.EventLoop next()  
      io.netty.channel.ChannelFuture register​(io.netty.channel.Channel channel)  
      io.netty.channel.ChannelFuture register​(io.netty.channel.ChannelPromise promise)  
      io.netty.channel.ChannelFuture register​(io.netty.channel.Channel channel, io.netty.channel.ChannelPromise promise)  
      io.netty.util.concurrent.ScheduledFuture<?> schedule​(java.lang.Runnable command, long delay, java.util.concurrent.TimeUnit unit)  
      <V> io.netty.util.concurrent.ScheduledFuture<V> schedule​(java.util.concurrent.Callable<V> callable, long delay, java.util.concurrent.TimeUnit unit)  
      io.netty.util.concurrent.ScheduledFuture<?> scheduleAtFixedRate​(java.lang.Runnable command, long initialDelay, long period, java.util.concurrent.TimeUnit unit)  
      io.netty.util.concurrent.ScheduledFuture<?> scheduleWithFixedDelay​(java.lang.Runnable command, long initialDelay, long delay, java.util.concurrent.TimeUnit unit)  
      void shutdown()
      Starts the shutdown process.
      io.netty.util.concurrent.Future<?> shutdownGracefully()  
      io.netty.util.concurrent.Future<?> shutdownGracefully​(long quietPeriod, long timeout, java.util.concurrent.TimeUnit unit)  
      java.util.List<java.lang.Runnable> shutdownNow()  
      io.netty.util.concurrent.Future<?> submit​(java.lang.Runnable task)  
      <T> io.netty.util.concurrent.Future<T> submit​(java.lang.Runnable task, T result)  
      <T> io.netty.util.concurrent.Future<T> submit​(java.util.concurrent.Callable<T> task)  
      io.netty.util.concurrent.Future<?> terminationFuture()  
      void waitForShutdown()
      Waits for shutdown to complete
      void waitForShutdown​(long timeoutInMs)
      Waits for shutdown to complete with a timeout
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Constructor Detail

      • ShutdownableEventLoopGroup

        public ShutdownableEventLoopGroup​(E eventLoop)
    • Method Detail

      • eventLoopGroup

        public E eventLoopGroup()
      • waitForShutdown

        public void waitForShutdown()
                             throws java.lang.InterruptedException,
                                    java.lang.IllegalStateException
        Description copied from interface: Shutdownable
        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
        Description copied from interface: Shutdownable
        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
      • isShuttingDown

        public boolean isShuttingDown()
        Specified by:
        isShuttingDown in interface io.netty.util.concurrent.EventExecutorGroup
      • shutdownGracefully

        public io.netty.util.concurrent.Future<?> shutdownGracefully()
        Specified by:
        shutdownGracefully in interface io.netty.util.concurrent.EventExecutorGroup
      • shutdownGracefully

        public io.netty.util.concurrent.Future<?> shutdownGracefully​(long quietPeriod,
                                                                     long timeout,
                                                                     java.util.concurrent.TimeUnit unit)
        Specified by:
        shutdownGracefully in interface io.netty.util.concurrent.EventExecutorGroup
      • terminationFuture

        public io.netty.util.concurrent.Future<?> terminationFuture()
        Specified by:
        terminationFuture in interface io.netty.util.concurrent.EventExecutorGroup
      • shutdown

        public void shutdown()
        Description copied from interface: Shutdownable
        Starts the shutdown process. It is recommended to perform the actual shutdown activity in a separate thread from the thread that calls shutdown
        Specified by:
        shutdown in interface io.netty.util.concurrent.EventExecutorGroup
        Specified by:
        shutdown in interface java.util.concurrent.ExecutorService
        Specified by:
        shutdown in interface Shutdownable
      • shutdownNow

        public java.util.List<java.lang.Runnable> shutdownNow()
        Specified by:
        shutdownNow in interface io.netty.util.concurrent.EventExecutorGroup
        Specified by:
        shutdownNow in interface java.util.concurrent.ExecutorService
      • isShutdown

        public boolean isShutdown()
        Specified by:
        isShutdown in interface java.util.concurrent.ExecutorService
      • isTerminated

        public boolean isTerminated()
        Specified by:
        isTerminated in interface java.util.concurrent.ExecutorService
      • awaitTermination

        public boolean awaitTermination​(long timeout,
                                        java.util.concurrent.TimeUnit unit)
                                 throws java.lang.InterruptedException
        Specified by:
        awaitTermination in interface java.util.concurrent.ExecutorService
        Throws:
        java.lang.InterruptedException
      • next

        public io.netty.channel.EventLoop next()
        Specified by:
        next in interface io.netty.util.concurrent.EventExecutorGroup
        Specified by:
        next in interface io.netty.channel.EventLoopGroup
      • iterator

        public java.util.Iterator<io.netty.util.concurrent.EventExecutor> iterator()
        Specified by:
        iterator in interface io.netty.util.concurrent.EventExecutorGroup
        Specified by:
        iterator in interface java.lang.Iterable<E extends io.netty.channel.EventLoopGroup>
      • submit

        public io.netty.util.concurrent.Future<?> submit​(java.lang.Runnable task)
        Specified by:
        submit in interface io.netty.util.concurrent.EventExecutorGroup
        Specified by:
        submit in interface java.util.concurrent.ExecutorService
      • invokeAll

        public <T> java.util.List<java.util.concurrent.Future<T>> invokeAll​(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks)
                                                                     throws java.lang.InterruptedException
        Specified by:
        invokeAll in interface java.util.concurrent.ExecutorService
        Throws:
        java.lang.InterruptedException
      • invokeAll

        public <T> java.util.List<java.util.concurrent.Future<T>> invokeAll​(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks,
                                                                            long timeout,
                                                                            java.util.concurrent.TimeUnit unit)
                                                                     throws java.lang.InterruptedException
        Specified by:
        invokeAll in interface java.util.concurrent.ExecutorService
        Throws:
        java.lang.InterruptedException
      • invokeAny

        public <T> T invokeAny​(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks)
                        throws java.lang.InterruptedException,
                               java.util.concurrent.ExecutionException
        Specified by:
        invokeAny in interface java.util.concurrent.ExecutorService
        Throws:
        java.lang.InterruptedException
        java.util.concurrent.ExecutionException
      • invokeAny

        public <T> T invokeAny​(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks,
                               long timeout,
                               java.util.concurrent.TimeUnit unit)
                        throws java.lang.InterruptedException,
                               java.util.concurrent.ExecutionException,
                               java.util.concurrent.TimeoutException
        Specified by:
        invokeAny in interface java.util.concurrent.ExecutorService
        Throws:
        java.lang.InterruptedException
        java.util.concurrent.ExecutionException
        java.util.concurrent.TimeoutException
      • submit

        public <T> io.netty.util.concurrent.Future<T> submit​(java.lang.Runnable task,
                                                             T result)
        Specified by:
        submit in interface io.netty.util.concurrent.EventExecutorGroup
        Specified by:
        submit in interface java.util.concurrent.ExecutorService
      • submit

        public <T> io.netty.util.concurrent.Future<T> submit​(java.util.concurrent.Callable<T> task)
        Specified by:
        submit in interface io.netty.util.concurrent.EventExecutorGroup
        Specified by:
        submit in interface java.util.concurrent.ExecutorService
      • schedule

        public io.netty.util.concurrent.ScheduledFuture<?> schedule​(java.lang.Runnable command,
                                                                    long delay,
                                                                    java.util.concurrent.TimeUnit unit)
        Specified by:
        schedule in interface io.netty.util.concurrent.EventExecutorGroup
        Specified by:
        schedule in interface java.util.concurrent.ScheduledExecutorService
      • schedule

        public <V> io.netty.util.concurrent.ScheduledFuture<V> schedule​(java.util.concurrent.Callable<V> callable,
                                                                        long delay,
                                                                        java.util.concurrent.TimeUnit unit)
        Specified by:
        schedule in interface io.netty.util.concurrent.EventExecutorGroup
        Specified by:
        schedule in interface java.util.concurrent.ScheduledExecutorService
      • scheduleAtFixedRate

        public io.netty.util.concurrent.ScheduledFuture<?> scheduleAtFixedRate​(java.lang.Runnable command,
                                                                               long initialDelay,
                                                                               long period,
                                                                               java.util.concurrent.TimeUnit unit)
        Specified by:
        scheduleAtFixedRate in interface io.netty.util.concurrent.EventExecutorGroup
        Specified by:
        scheduleAtFixedRate in interface java.util.concurrent.ScheduledExecutorService
      • scheduleWithFixedDelay

        public io.netty.util.concurrent.ScheduledFuture<?> scheduleWithFixedDelay​(java.lang.Runnable command,
                                                                                  long initialDelay,
                                                                                  long delay,
                                                                                  java.util.concurrent.TimeUnit unit)
        Specified by:
        scheduleWithFixedDelay in interface io.netty.util.concurrent.EventExecutorGroup
        Specified by:
        scheduleWithFixedDelay in interface java.util.concurrent.ScheduledExecutorService
      • register

        public io.netty.channel.ChannelFuture register​(io.netty.channel.Channel channel)
        Specified by:
        register in interface io.netty.channel.EventLoopGroup
      • register

        public io.netty.channel.ChannelFuture register​(io.netty.channel.ChannelPromise promise)
        Specified by:
        register in interface io.netty.channel.EventLoopGroup
      • register

        public io.netty.channel.ChannelFuture register​(io.netty.channel.Channel channel,
                                                       io.netty.channel.ChannelPromise promise)
        Specified by:
        register in interface io.netty.channel.EventLoopGroup
      • execute

        public void execute​(java.lang.Runnable command)
        Specified by:
        execute in interface java.util.concurrent.Executor