public final class GlobalEventExecutor extends AbstractScheduledEventExecutor
EventExecutor. It starts the thread automatically and stops it when there is no
task pending in the task queue for 1 second. Please note it is not scalable to schedule large number of tasks to
this executor; use a dedicated executor.| Modifier and Type | Field and Description |
|---|---|
static GlobalEventExecutor |
INSTANCE |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitInactivity(long timeout,
TimeUnit unit)
Waits until the worker thread of this executor has no tasks left in its task queue and terminates itself.
|
boolean |
awaitTermination(long timeout,
TimeUnit unit) |
void |
execute(Runnable task) |
boolean |
inEventLoop(Thread thread)
|
boolean |
isShutdown() |
boolean |
isShuttingDown()
|
boolean |
isTerminated() |
EventExecutorGroup |
parent()
Return the
EventExecutorGroup which is the parent of this EventExecutor, |
int |
pendingTasks()
Return the number of tasks that are pending for processing.
|
void |
shutdown()
Deprecated.
|
Future<?> |
shutdownGracefully(long quietPeriod,
long timeout,
TimeUnit unit)
Signals this executor that the caller wants the executor to be shut down.
|
Future<?> |
terminationFuture()
Returns the
Future which is notified when this executor has been terminated. |
cancelScheduledTasks, hasScheduledTasks, nanoTime, nextScheduledTaskNano, pollScheduledTask, pollScheduledTask, schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelayinEventLoop, iterator, newFailedFuture, newProgressivePromise, newPromise, newSucceededFuture, newTaskFor, newTaskFor, next, shutdownGracefully, shutdownNow, submit, submit, submitinvokeAll, invokeAll, invokeAny, invokeAnyclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitinvokeAll, invokeAll, invokeAny, invokeAnyforEach, spliteratorpublic static final GlobalEventExecutor INSTANCE
public EventExecutorGroup parent()
EventExecutorEventExecutorGroup which is the parent of this EventExecutor,public int pendingTasks()
public boolean inEventLoop(Thread thread)
EventExecutorpublic Future<?> shutdownGracefully(long quietPeriod, long timeout, 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.quietPeriod - 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 this executor has been terminated.@Deprecated public void shutdown()
shutdown in interface EventExecutorGroupshutdown in interface ExecutorServiceshutdown in class AbstractEventExecutorpublic boolean isShuttingDown()
EventExecutorGrouppublic boolean isShutdown()
public boolean isTerminated()
public boolean awaitTermination(long timeout,
TimeUnit unit)
public boolean awaitInactivity(long timeout,
TimeUnit unit)
throws InterruptedException
true if and only if the worker thread has been terminatedInterruptedExceptionpublic void execute(Runnable task)
Copyright © 2008–2017 The Netty Project. All rights reserved.