private static final class NonStickyEventExecutorGroup.NonStickyOrderedEventExecutor extends AbstractEventExecutor implements java.lang.Runnable, OrderedEventExecutor
| Modifier and Type | Field and Description |
|---|---|
private EventExecutor |
executor |
private int |
maxTaskExecutePerRun |
private static int |
NONE |
private static int |
RUNNING |
private java.util.concurrent.atomic.AtomicInteger |
state |
private static int |
SUBMITTED |
private java.util.Queue<java.lang.Runnable> |
tasks |
DEFAULT_SHUTDOWN_QUIET_PERIOD, DEFAULT_SHUTDOWN_TIMEOUT| Constructor and Description |
|---|
NonStickyOrderedEventExecutor(EventExecutor executor,
int maxTaskExecutePerRun) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long timeout,
java.util.concurrent.TimeUnit unit) |
void |
execute(java.lang.Runnable command) |
boolean |
inEventLoop()
Calls
EventExecutor.inEventLoop(Thread) with Thread.currentThread() as argument |
boolean |
inEventLoop(java.lang.Thread thread)
Return
true if the given Thread is executed in the event loop,
false otherwise. |
boolean |
isShutdown() |
boolean |
isShuttingDown()
Returns
true if and only if all EventExecutors managed by this EventExecutorGroup
are being shut down gracefully or was shut down. |
boolean |
isTerminated() |
void |
run() |
void |
shutdown() |
Future<?> |
shutdownGracefully(long quietPeriod,
long timeout,
java.util.concurrent.TimeUnit unit)
Signals this executor that the caller wants the executor to be shut down.
|
Future<?> |
terminationFuture()
Returns the
Future which is notified when all EventExecutors managed by this
EventExecutorGroup have been terminated. |
iterator, newFailedFuture, newProgressivePromise, newPromise, newSucceededFuture, newTaskFor, newTaskFor, next, parent, safeExecute, schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelay, shutdownGracefully, shutdownNow, submit, submit, submitinvokeAll, invokeAll, invokeAny, invokeAnyclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitnewFailedFuture, newProgressivePromise, newPromise, newSucceededFuture, next, parentiterator, schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelay, shutdownGracefully, shutdownNow, submit, submit, submitprivate final EventExecutor executor
private final java.util.Queue<java.lang.Runnable> tasks
private static final int NONE
private static final int SUBMITTED
private static final int RUNNING
private final java.util.concurrent.atomic.AtomicInteger state
private final int maxTaskExecutePerRun
NonStickyOrderedEventExecutor(EventExecutor executor, int maxTaskExecutePerRun)
public void run()
run in interface java.lang.Runnablepublic boolean inEventLoop(java.lang.Thread thread)
EventExecutortrue if the given Thread is executed in the event loop,
false otherwise.inEventLoop in interface EventExecutorpublic boolean inEventLoop()
EventExecutorEventExecutor.inEventLoop(Thread) with Thread.currentThread() as argumentinEventLoop in interface EventExecutorinEventLoop in class AbstractEventExecutorpublic boolean isShuttingDown()
EventExecutorGrouptrue if and only if all EventExecutors managed by this EventExecutorGroup
are being shut down gracefully or was shut down.isShuttingDown in interface EventExecutorGrouppublic Future<?> shutdownGracefully(long quietPeriod, long timeout, java.util.concurrent.TimeUnit unit)
EventExecutorGroupEventExecutorGroup.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.shutdownGracefully in interface EventExecutorGroupquietPeriod - the quiet period as described in the documentationtimeout - the maximum amount of time to wait until the executor is EventExecutorGroup.shutdown()
regardless if a task was submitted during the quiet periodunit - the unit of quietPeriod and timeoutEventExecutorGroup.terminationFuture()public Future<?> terminationFuture()
EventExecutorGroupFuture which is notified when all EventExecutors managed by this
EventExecutorGroup have been terminated.terminationFuture in interface EventExecutorGrouppublic void shutdown()
shutdown in interface EventExecutorGroupshutdown in interface java.util.concurrent.ExecutorServiceshutdown in class AbstractEventExecutorpublic boolean isShutdown()
isShutdown in interface java.util.concurrent.ExecutorServicepublic boolean isTerminated()
isTerminated in interface java.util.concurrent.ExecutorServicepublic boolean awaitTermination(long timeout,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException
awaitTermination in interface java.util.concurrent.ExecutorServicejava.lang.InterruptedExceptionpublic void execute(java.lang.Runnable command)
execute in interface java.util.concurrent.Executor