EventExecutor
. It starts the thread automatically and stops it when there is no
task pending in the task queue for io.netty.globalEventExecutor.quietPeriodSeconds
second
(default is 1 second). Please note it is not scalable to schedule large number of tasks to this executor;
use a dedicated executor.
Modifier and Type | Class and Description |
---|---|
pack-priv class |
Modifier and Type | Field and Description |
---|---|
public static final GlobalEventExecutor | |
private static final InternalLogger | |
pack-priv final ScheduledFutureTask | |
private static final long | |
private final AtomicBoolean | |
pack-priv final BlockingQueue | |
private final GlobalEventExecutor. | |
private final Future | |
pack-priv volatile Thread | |
pack-priv final ThreadFactory |
Access | Constructor and Description |
---|---|
private |
Modifier and Type | Method and Description |
---|---|
private void | addTask(Runnable task)
Add a task to the task queue, or throws a |
public boolean | Returns: true if and only if the worker thread has been terminatedWaits until the worker thread of this executor has no tasks left in its task queue and terminates itself. |
public boolean | awaitTermination(long
the maximum time to wait timeout, TimeUnit the time unit of the timeout argument unit)Implements java. |
public void | execute(Runnable
the runnable task task)Implements java. |
private void | |
private void | |
public boolean | inEventLoop(Thread thread)
Implements io. true if the given Thread is executed in the event loop,
false otherwise.
|
public boolean | isShutdown()
Implements java. true if this executor has been shut down.
|
public boolean | isShuttingDown()
Implements io. true if and only if all EventExecutor s managed by this EventExecutorGroup
are being shut down gracefully or was shut down.
|
public boolean | isTerminated()
Implements java. true if all tasks have completed following shut down.
|
public int | |
public void | shutdown()
Implements abstract io. Implements io.
Deprecated
Initiates an orderly shutdown in which previously submitted
tasks are executed, but no new tasks will be accepted.
|
public Future | shutdownGracefully(long
the quiet period as described in the documentation quietPeriod, long the maximum amount of time to wait until the executor is shutdown()
regardless if a task was submitted during the quiet period timeout, TimeUnit the unit of unit)quietPeriod and timeout Implements io. |
private void | |
pack-priv Runnable | |
public Future | terminationFuture()
Implements io. Future which is notified when all EventExecutor s managed by this
EventExecutorGroup have been terminated.
|
INSTANCE | back to summary |
---|---|
public static final GlobalEventExecutor INSTANCE |
logger | back to summary |
---|---|
private static final InternalLogger logger Hides io. |
quietPeriodTask | back to summary |
---|---|
pack-priv final ScheduledFutureTask<Void> quietPeriodTask |
SCHEDULE_QUIET_PERIOD_INTERVAL | back to summary |
---|---|
private static final long SCHEDULE_QUIET_PERIOD_INTERVAL |
started | back to summary |
---|---|
private final AtomicBoolean started |
taskQueue | back to summary |
---|---|
pack-priv final BlockingQueue<Runnable> taskQueue |
taskRunner | back to summary |
---|---|
private final GlobalEventExecutor. |
terminationFuture | back to summary |
---|---|
private final Future<?> terminationFuture |
thread | back to summary |
---|---|
pack-priv volatile Thread thread |
threadFactory | back to summary |
---|---|
pack-priv final ThreadFactory threadFactory |
GlobalEventExecutor | back to summary |
---|---|
private GlobalEventExecutor() |
addTask | back to summary |
---|---|
private void addTask(Runnable task) Add a task to the task queue, or throws a |
awaitInactivity | back to summary |
---|---|
public boolean awaitInactivity(long timeout, TimeUnit unit) throws InterruptedException Waits until the worker thread of this executor has no tasks left in its task queue and terminates itself. Because a new worker thread will be started again when a new task is submitted, this operation is only useful when you want to ensure that the worker thread is terminated after your application is shut down and there's no chance of submitting a new task afterwards.
|
awaitTermination | back to summary |
---|---|
public boolean awaitTermination(long timeout, TimeUnit unit) Implements java. Doc from java. Blocks until all tasks have completed execution after a shutdown request, or the timeout occurs, or the current thread is interrupted, whichever happens first. |
execute | back to summary |
---|---|
public void execute(Runnable task) Implements java. Doc from java. Executes the given command at some time in the future. The command
may execute in a new thread, in a pooled thread, or in the calling
thread, at the discretion of the |
execute0 | back to summary |
---|---|
private void execute0(Runnable task) |
fetchFromScheduledTaskQueue | back to summary |
---|---|
private void fetchFromScheduledTaskQueue() |
inEventLoop | back to summary |
---|---|
public boolean inEventLoop(Thread thread) Implements io. Doc from io. Return
|
isShutdown | back to summary |
---|---|
public boolean isShutdown() Implements java. Doc from java. Returns
|
isShuttingDown | back to summary |
---|---|
public boolean isShuttingDown() Implements io. Doc from io. Returns
|
isTerminated | back to summary |
---|---|
public boolean isTerminated() Implements java. Doc from java. Returns
|
pendingTasks | back to summary |
---|---|
public int pendingTasks() Return the number of tasks that are pending for processing. |
shutdown | back to summary |
---|---|
public void shutdown() Implements abstract io. Implements io. Doc from java. Deprecated
Initiates an orderly shutdown in which previously submitted tasks are executed, but no new tasks will be accepted. Invocation has no additional effect if already shut down. This method does not wait for previously submitted tasks to
complete execution. Use
|
shutdownGracefully | back to summary |
---|---|
public Future Implements io. Doc from io. Signals this executor that the caller wants the executor to be shut down. Once this method is called,
|
startThread | back to summary |
---|---|
private void startThread() |
takeTask | back to summary |
---|---|
pack-priv Runnable takeTask() Take the next
|
terminationFuture | back to summary |
---|---|
public Future Implements io. Doc from io. Returns the
|
Access | Constructor and Description |
---|---|
pack-priv |
Modifier and Type | Method and Description |
---|---|
public void |
TaskRunner | back to summary |
---|---|
pack-priv TaskRunner() |
run | back to summary |
---|---|
public void run() Implements java. Doc from java. Runs this operation.
|