Class NonStickyEventExecutorGroup.NonStickyOrderedEventExecutor

java.lang.Object
java.util.concurrent.AbstractExecutorService
io.netty.util.concurrent.AbstractEventExecutor
io.netty.util.concurrent.NonStickyEventExecutorGroup.NonStickyOrderedEventExecutor
All Implemented Interfaces:
EventExecutor, EventExecutorGroup, OrderedEventExecutor, ThreadAwareExecutor, java.lang.Iterable<EventExecutor>, java.lang.Runnable, java.util.concurrent.Executor, java.util.concurrent.ExecutorService, java.util.concurrent.ScheduledExecutorService
Enclosing class:
NonStickyEventExecutorGroup

private static final class NonStickyEventExecutorGroup.NonStickyOrderedEventExecutor extends AbstractEventExecutor implements java.lang.Runnable, OrderedEventExecutor
  • Field Details

    • executor

      private final EventExecutor executor
    • tasks

      private final java.util.Queue<java.lang.Runnable> tasks
    • NONE

      private static final int NONE
      See Also:
    • SUBMITTED

      private static final int SUBMITTED
      See Also:
    • RUNNING

      private static final int RUNNING
      See Also:
    • state

      private final java.util.concurrent.atomic.AtomicInteger state
    • maxTaskExecutePerRun

      private final int maxTaskExecutePerRun
    • executingThread

      private final java.util.concurrent.atomic.AtomicReference<java.lang.Thread> executingThread
  • Constructor Details

    • NonStickyOrderedEventExecutor

      NonStickyOrderedEventExecutor(EventExecutor executor, int maxTaskExecutePerRun)
  • Method Details

    • run

      public void run()
      Specified by:
      run in interface java.lang.Runnable
    • inEventLoop

      public boolean inEventLoop(java.lang.Thread thread)
      Description copied from interface: EventExecutor
      Return true if the given Thread is executed in the event loop, false otherwise.
      Specified by:
      inEventLoop in interface EventExecutor
    • isShuttingDown

      public boolean isShuttingDown()
      Description copied from interface: EventExecutorGroup
      Returns true if and only if all EventExecutors managed by this EventExecutorGroup are being shut down gracefully or was shut down.
      Specified by:
      isShuttingDown in interface EventExecutorGroup
    • shutdownGracefully

      public Future<?> shutdownGracefully(long quietPeriod, long timeout, java.util.concurrent.TimeUnit unit)
      Description copied from interface: EventExecutorGroup
      Signals this executor that the caller wants the executor to be shut down. Once this method is called, EventExecutorGroup.isShuttingDown() starts to return true, and the executor prepares to shut itself down. Unlike EventExecutorGroup.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.
      Specified by:
      shutdownGracefully in interface EventExecutorGroup
      Parameters:
      quietPeriod - the quiet period as described in the documentation
      timeout - the maximum amount of time to wait until the executor is EventExecutorGroup.shutdown() regardless if a task was submitted during the quiet period
      unit - the unit of quietPeriod and timeout
      Returns:
      the EventExecutorGroup.terminationFuture()
    • terminationFuture

      public Future<?> terminationFuture()
      Description copied from interface: EventExecutorGroup
      Returns the Future which is notified when all EventExecutors managed by this EventExecutorGroup have been terminated.
      Specified by:
      terminationFuture in interface EventExecutorGroup
    • shutdown

      public void shutdown()
      Specified by:
      shutdown in interface EventExecutorGroup
      Specified by:
      shutdown in interface java.util.concurrent.ExecutorService
      Specified by:
      shutdown in class AbstractEventExecutor
    • 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
    • execute

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