Interface EventExecutorGroup

All Superinterfaces:
java.util.concurrent.Executor, java.util.concurrent.ExecutorService, java.lang.Iterable<EventExecutor>, java.util.concurrent.ScheduledExecutorService
All Known Subinterfaces:
EventExecutor, EventLoop, EventLoopGroup, IoEventLoop, IoEventLoopGroup, OrderedEventExecutor
All Known Implementing Classes:
AbstractEventExecutor, AbstractEventExecutorGroup, AbstractEventLoop, AbstractEventLoopGroup, AbstractScheduledEventExecutor, DefaultEventExecutor, DefaultEventExecutorGroup, DefaultEventLoop, DefaultEventLoopGroup, EmbeddedEventLoop, EpollEventLoop, EpollEventLoopGroup, GlobalEventExecutor, ImmediateEventExecutor, KQueueEventLoopGroup, KQueueEventLoopGroup.KQueueEventLoop, LocalEventLoopGroup, ManualIoEventLoop, MultithreadEventExecutorGroup, MultithreadEventLoopGroup, MultiThreadIoEventLoopGroup, NioEventLoop, NioEventLoopGroup, NonStickyEventExecutorGroup, NonStickyEventExecutorGroup.NonStickyOrderedEventExecutor, OioEventLoopGroup, SingleThreadEventExecutor, SingleThreadEventLoop, SingleThreadIoEventLoop, ThreadPerChannelEventLoop, ThreadPerChannelEventLoopGroup, UnorderedThreadPoolEventExecutor

public interface EventExecutorGroup extends java.util.concurrent.ScheduledExecutorService, java.lang.Iterable<EventExecutor>
The EventExecutorGroup is responsible for providing the EventExecutor's to use via its next() method. Besides this, it is also responsible for handling their life-cycle and allows shutting them down in a global fashion.
  • Method Details

    • isShuttingDown

      boolean isShuttingDown()
      Returns true if and only if all EventExecutors managed by this EventExecutorGroup are being shut down gracefully or was shut down.
    • shutdownGracefully

      Future<?> shutdownGracefully()
      Shortcut method for shutdownGracefully(long, long, TimeUnit) with sensible default values.
      Returns:
      the terminationFuture()
    • shutdownGracefully

      Future<?> shutdownGracefully(long quietPeriod, long timeout, java.util.concurrent.TimeUnit unit)
      Signals this executor that the caller wants the executor to be shut down. Once this method is called, isShuttingDown() starts to return true, and the executor prepares to shut itself down. Unlike shutdown(), graceful shutdown ensures that no tasks are submitted for 'the quiet period' (usually a couple seconds) before it shuts itself down. If a task is submitted during the quiet period, it is guaranteed to be accepted and the quiet period will start over.
      Parameters:
      quietPeriod - the quiet period as described in the documentation
      timeout - the maximum amount of time to wait until the executor is shutdown() regardless if a task was submitted during the quiet period
      unit - the unit of quietPeriod and timeout
      Returns:
      the terminationFuture()
    • terminationFuture

      Future<?> terminationFuture()
      Returns the Future which is notified when all EventExecutors managed by this EventExecutorGroup have been terminated.
    • shutdown

      @Deprecated void shutdown()
      Specified by:
      shutdown in interface java.util.concurrent.ExecutorService
    • shutdownNow

      @Deprecated java.util.List<java.lang.Runnable> shutdownNow()
      Specified by:
      shutdownNow in interface java.util.concurrent.ExecutorService
    • next

      Returns one of the EventExecutors managed by this EventExecutorGroup.
    • iterator

      java.util.Iterator<EventExecutor> iterator()
      Specified by:
      iterator in interface java.lang.Iterable<EventExecutor>
    • submit

      Future<?> submit(java.lang.Runnable task)
      Specified by:
      submit in interface java.util.concurrent.ExecutorService
    • submit

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

      <T> Future<T> submit(java.util.concurrent.Callable<T> task)
      Specified by:
      submit in interface java.util.concurrent.ExecutorService
    • ticker

      default Ticker ticker()
      The ticker for this executor. Usually the schedule(Runnable, long, TimeUnit) methods will follow the system ticker (i.e. System.nanoTime()), but especially for testing it is sometimes useful to have more control over the ticker. In that case, this method will be overridden. Code that schedules tasks on this executor should use this ticker in order to stay consistent with the executor (e.g. not be surprised by scheduled tasks running "early").
      Returns:
      The ticker for this scheduler
    • schedule

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

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

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

      ScheduledFuture<?> scheduleWithFixedDelay(java.lang.Runnable command, long initialDelay, long delay, java.util.concurrent.TimeUnit unit)
      Specified by:
      scheduleWithFixedDelay in interface java.util.concurrent.ScheduledExecutorService