@UnstableApi public final class NonStickyEventExecutorGroup extends java.lang.Object implements EventExecutorGroup
EventExecutorGroup which will preserve Runnable execution order but makes no guarantees about what
EventExecutor (and therefore Thread) will be used to execute the Runnables.
The EventExecutorGroup.next() for the wrapped EventExecutorGroup must NOT return
executors of type OrderedEventExecutor.
| 构造器和说明 |
|---|
NonStickyEventExecutorGroup(EventExecutorGroup group)
Creates a new instance.
|
NonStickyEventExecutorGroup(EventExecutorGroup group,
int maxTaskExecutePerRun)
Creates a new instance.
|
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
awaitTermination(long timeout,
java.util.concurrent.TimeUnit unit) |
void |
execute(java.lang.Runnable command) |
<T> java.util.List<java.util.concurrent.Future<T>> |
invokeAll(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks) |
<T> java.util.List<java.util.concurrent.Future<T>> |
invokeAll(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks,
long timeout,
java.util.concurrent.TimeUnit unit) |
<T> T |
invokeAny(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks) |
<T> T |
invokeAny(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks,
long timeout,
java.util.concurrent.TimeUnit unit) |
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() |
java.util.Iterator<EventExecutor> |
iterator() |
EventExecutor |
next()
Returns one of the
EventExecutors managed by this EventExecutorGroup. |
<V> ScheduledFuture<V> |
schedule(java.util.concurrent.Callable<V> callable,
long delay,
java.util.concurrent.TimeUnit unit) |
ScheduledFuture<?> |
schedule(java.lang.Runnable command,
long delay,
java.util.concurrent.TimeUnit unit) |
ScheduledFuture<?> |
scheduleAtFixedRate(java.lang.Runnable command,
long initialDelay,
long period,
java.util.concurrent.TimeUnit unit) |
ScheduledFuture<?> |
scheduleWithFixedDelay(java.lang.Runnable command,
long initialDelay,
long delay,
java.util.concurrent.TimeUnit unit) |
void |
shutdown() |
Future<?> |
shutdownGracefully()
Shortcut method for
EventExecutorGroup.shutdownGracefully(long, long, TimeUnit) with sensible default values. |
Future<?> |
shutdownGracefully(long quietPeriod,
long timeout,
java.util.concurrent.TimeUnit unit)
Signals this executor that the caller wants the executor to be shut down.
|
java.util.List<java.lang.Runnable> |
shutdownNow() |
<T> Future<T> |
submit(java.util.concurrent.Callable<T> task) |
Future<?> |
submit(java.lang.Runnable task) |
<T> Future<T> |
submit(java.lang.Runnable task,
T result) |
Future<?> |
terminationFuture()
Returns the
Future which is notified when all EventExecutors managed by this
EventExecutorGroup have been terminated. |
public NonStickyEventExecutorGroup(EventExecutorGroup group)
EventExecutorGroup MUST NOT contain
any OrderedEventExecutors.public NonStickyEventExecutorGroup(EventExecutorGroup group, int maxTaskExecutePerRun)
EventExecutorGroup MUST NOT contain
any OrderedEventExecutors.public boolean isShuttingDown()
EventExecutorGrouptrue if and only if all EventExecutors managed by this EventExecutorGroup
are being shut down gracefully or was shut down.isShuttingDown 在接口中 EventExecutorGrouppublic Future<?> shutdownGracefully()
EventExecutorGroupEventExecutorGroup.shutdownGracefully(long, long, TimeUnit) with sensible default values.shutdownGracefully 在接口中 EventExecutorGroupEventExecutorGroup.terminationFuture()public 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 在接口中 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 在接口中 EventExecutorGrouppublic void shutdown()
shutdown 在接口中 EventExecutorGroupshutdown 在接口中 java.util.concurrent.ExecutorServicepublic java.util.List<java.lang.Runnable> shutdownNow()
shutdownNow 在接口中 EventExecutorGroupshutdownNow 在接口中 java.util.concurrent.ExecutorServicepublic EventExecutor next()
EventExecutorGroupEventExecutors managed by this EventExecutorGroup.next 在接口中 EventExecutorGrouppublic java.util.Iterator<EventExecutor> iterator()
iterator 在接口中 EventExecutorGroupiterator 在接口中 java.lang.Iterable<EventExecutor>public Future<?> submit(java.lang.Runnable task)
submit 在接口中 EventExecutorGroupsubmit 在接口中 java.util.concurrent.ExecutorServicepublic <T> Future<T> submit(java.lang.Runnable task, T result)
submit 在接口中 EventExecutorGroupsubmit 在接口中 java.util.concurrent.ExecutorServicepublic <T> Future<T> submit(java.util.concurrent.Callable<T> task)
submit 在接口中 EventExecutorGroupsubmit 在接口中 java.util.concurrent.ExecutorServicepublic ScheduledFuture<?> schedule(java.lang.Runnable command, long delay, java.util.concurrent.TimeUnit unit)
schedule 在接口中 EventExecutorGroupschedule 在接口中 java.util.concurrent.ScheduledExecutorServicepublic <V> ScheduledFuture<V> schedule(java.util.concurrent.Callable<V> callable, long delay, java.util.concurrent.TimeUnit unit)
schedule 在接口中 EventExecutorGroupschedule 在接口中 java.util.concurrent.ScheduledExecutorServicepublic ScheduledFuture<?> scheduleAtFixedRate(java.lang.Runnable command, long initialDelay, long period, java.util.concurrent.TimeUnit unit)
scheduleAtFixedRate 在接口中 EventExecutorGroupscheduleAtFixedRate 在接口中 java.util.concurrent.ScheduledExecutorServicepublic ScheduledFuture<?> scheduleWithFixedDelay(java.lang.Runnable command, long initialDelay, long delay, java.util.concurrent.TimeUnit unit)
scheduleWithFixedDelay 在接口中 EventExecutorGroupscheduleWithFixedDelay 在接口中 java.util.concurrent.ScheduledExecutorServicepublic boolean isShutdown()
isShutdown 在接口中 java.util.concurrent.ExecutorServicepublic boolean isTerminated()
isTerminated 在接口中 java.util.concurrent.ExecutorServicepublic boolean awaitTermination(long timeout,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException
awaitTermination 在接口中 java.util.concurrent.ExecutorServicejava.lang.InterruptedExceptionpublic <T> java.util.List<java.util.concurrent.Future<T>> invokeAll(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks)
throws java.lang.InterruptedException
invokeAll 在接口中 java.util.concurrent.ExecutorServicejava.lang.InterruptedExceptionpublic <T> java.util.List<java.util.concurrent.Future<T>> invokeAll(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks,
long timeout,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException
invokeAll 在接口中 java.util.concurrent.ExecutorServicejava.lang.InterruptedExceptionpublic <T> T invokeAny(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks)
throws java.lang.InterruptedException,
java.util.concurrent.ExecutionException
invokeAny 在接口中 java.util.concurrent.ExecutorServicejava.lang.InterruptedExceptionjava.util.concurrent.ExecutionExceptionpublic <T> T invokeAny(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks,
long timeout,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException,
java.util.concurrent.ExecutionException,
java.util.concurrent.TimeoutException
invokeAny 在接口中 java.util.concurrent.ExecutorServicejava.lang.InterruptedExceptionjava.util.concurrent.ExecutionExceptionjava.util.concurrent.TimeoutExceptionpublic void execute(java.lang.Runnable command)
execute 在接口中 java.util.concurrent.Executor