public final class GlobalEventExecutor extends AbstractEventExecutor
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 |
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.
|
<V> ScheduledFuture<V> |
schedule(Callable<V> callable,
long delay,
TimeUnit unit) |
ScheduledFuture<?> |
schedule(Runnable command,
long delay,
TimeUnit unit) |
ScheduledFuture<?> |
scheduleAtFixedRate(Runnable command,
long initialDelay,
long period,
TimeUnit unit) |
ScheduledFuture<?> |
scheduleWithFixedDelay(Runnable command,
long initialDelay,
long delay,
TimeUnit unit) |
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. |
inEventLoop, iterator, newFailedFuture, newProgressivePromise, newPromise, newSucceededFuture, newTaskFor, newTaskFor, next, shutdownGracefully, shutdownNow, submit, submit, submit
invokeAll, invokeAll, invokeAny, invokeAny
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
invokeAll, invokeAll, invokeAny, invokeAny
public static final GlobalEventExecutor INSTANCE
public EventExecutorGroup parent()
EventExecutor
EventExecutorGroup
which is the parent of this EventExecutor
,public int pendingTasks()
public boolean inEventLoop(Thread thread)
EventExecutor
public Future<?> shutdownGracefully(long quietPeriod, long timeout, TimeUnit unit)
EventExecutorGroup
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.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 timeout
EventExecutorGroup.terminationFuture()
public Future<?> terminationFuture()
EventExecutorGroup
Future
which is notified when this executor has been terminated.@Deprecated public void shutdown()
shutdown
in interface EventExecutorGroup
shutdown
in interface ExecutorService
shutdown
in class AbstractEventExecutor
public boolean isShuttingDown()
EventExecutorGroup
public boolean isShutdown()
public boolean isTerminated()
public boolean awaitTermination(long timeout, TimeUnit unit)
public void execute(Runnable task)
public ScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit)
schedule
in interface EventExecutorGroup
schedule
in interface ScheduledExecutorService
schedule
in class AbstractEventExecutor
public <V> ScheduledFuture<V> schedule(Callable<V> callable, long delay, TimeUnit unit)
schedule
in interface EventExecutorGroup
schedule
in interface ScheduledExecutorService
schedule
in class AbstractEventExecutor
public ScheduledFuture<?> scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit)
scheduleAtFixedRate
in interface EventExecutorGroup
scheduleAtFixedRate
in interface ScheduledExecutorService
scheduleAtFixedRate
in class AbstractEventExecutor
public ScheduledFuture<?> scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit)
scheduleWithFixedDelay
in interface EventExecutorGroup
scheduleWithFixedDelay
in interface ScheduledExecutorService
scheduleWithFixedDelay
in class AbstractEventExecutor
Copyright © 2008–2013 The Netty Project. All rights reserved.