public final class GlobalEventExecutor extends AbstractScheduledEventExecutor implements OrderedEventExecutor
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.AbstractEventExecutor.LazyRunnable
限定符和类型 | 字段和说明 |
---|---|
static GlobalEventExecutor |
INSTANCE |
限定符和类型 | 方法和说明 |
---|---|
boolean |
awaitInactivity(long timeout,
java.util.concurrent.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,
java.util.concurrent.TimeUnit unit) |
void |
execute(java.lang.Runnable task) |
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 EventExecutor s managed by this EventExecutorGroup
are being shut down gracefully or was shut down. |
boolean |
isTerminated() |
int |
pendingTasks()
Return the number of tasks that are pending for processing.
|
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 EventExecutor s managed by this
EventExecutorGroup have been terminated. |
afterScheduledTaskSubmitted, beforeScheduledTaskSubmitted, cancelScheduledTasks, deadlineToDelayNanos, getCurrentTimeNanos, hasScheduledTasks, initialNanoTime, nanoTime, nextScheduledTaskDeadlineNanos, nextScheduledTaskNano, pollScheduledTask, pollScheduledTask, schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelay, validateScheduled
inEventLoop, iterator, lazyExecute, newFailedFuture, newProgressivePromise, newPromise, newSucceededFuture, newTaskFor, newTaskFor, next, parent, runTask, safeExecute, shutdownGracefully, shutdownNow, submit, submit, submit
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
inEventLoop, newFailedFuture, newProgressivePromise, newPromise, newSucceededFuture, next, parent
iterator, schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelay, shutdownGracefully, shutdownNow, submit, submit, submit
public static final GlobalEventExecutor INSTANCE
public int pendingTasks()
public boolean inEventLoop(java.lang.Thread thread)
EventExecutor
true
if the given Thread
is executed in the event loop,
false
otherwise.inEventLoop
在接口中 EventExecutor
public Future<?> shutdownGracefully(long quietPeriod, long timeout, java.util.concurrent.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.shutdownGracefully
在接口中 EventExecutorGroup
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 all EventExecutor
s managed by this
EventExecutorGroup
have been terminated.terminationFuture
在接口中 EventExecutorGroup
@Deprecated public void shutdown()
shutdown
在接口中 EventExecutorGroup
shutdown
在接口中 java.util.concurrent.ExecutorService
shutdown
在类中 AbstractEventExecutor
public boolean isShuttingDown()
EventExecutorGroup
true
if and only if all EventExecutor
s managed by this EventExecutorGroup
are being shut down gracefully or was shut down.isShuttingDown
在接口中 EventExecutorGroup
public boolean isShutdown()
isShutdown
在接口中 java.util.concurrent.ExecutorService
public boolean isTerminated()
isTerminated
在接口中 java.util.concurrent.ExecutorService
public boolean awaitTermination(long timeout, java.util.concurrent.TimeUnit unit)
awaitTermination
在接口中 java.util.concurrent.ExecutorService
public boolean awaitInactivity(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
true
if and only if the worker thread has been terminatedjava.lang.InterruptedException
public void execute(java.lang.Runnable task)
execute
在接口中 java.util.concurrent.Executor