public final class UnorderedThreadPoolEventExecutor extends ScheduledThreadPoolExecutor implements EventExecutor
EventExecutor
implementation which makes no guarantees about the ordering of task execution that
are submitted because there may be multiple threads executing these tasks.
This implementation is most useful for protocols that do not need strict ordering.
Because it provides no ordering care should be taken when using it!ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy
Constructor and Description |
---|
UnorderedThreadPoolEventExecutor(int corePoolSize)
|
UnorderedThreadPoolEventExecutor(int corePoolSize,
RejectedExecutionHandler handler)
|
UnorderedThreadPoolEventExecutor(int corePoolSize,
ThreadFactory threadFactory)
|
UnorderedThreadPoolEventExecutor(int corePoolSize,
ThreadFactory threadFactory,
RejectedExecutionHandler handler)
|
Modifier and Type | Method and Description |
---|---|
protected <V> RunnableScheduledFuture<V> |
decorateTask(Callable<V> callable,
RunnableScheduledFuture<V> task) |
protected <V> RunnableScheduledFuture<V> |
decorateTask(Runnable runnable,
RunnableScheduledFuture<V> task) |
void |
execute(Runnable command) |
boolean |
inEventLoop()
Calls
EventExecutor.inEventLoop(Thread) with Thread.currentThread() as argument |
boolean |
inEventLoop(Thread thread)
|
boolean |
isShuttingDown()
Returns
true if and only if all EventExecutor s managed by this EventExecutorGroup
are being shut down gracefully or was shut down. |
Iterator<EventExecutor> |
iterator() |
<V> Future<V> |
newFailedFuture(Throwable cause)
Create a new
Future which is marked as failed already. |
<V> ProgressivePromise<V> |
newProgressivePromise()
Create a new
ProgressivePromise . |
<V> Promise<V> |
newPromise()
Return a new
Promise . |
<V> Future<V> |
newSucceededFuture(V result)
Create a new
Future which is marked as succeeded already. |
EventExecutor |
next()
Returns a reference to itself.
|
EventExecutorGroup |
parent()
Return the
EventExecutorGroup which is the parent of this EventExecutor , |
<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() |
Future<?> |
shutdownGracefully()
Shortcut method for
EventExecutorGroup.shutdownGracefully(long, long, TimeUnit) with sensible default values. |
Future<?> |
shutdownGracefully(long quietPeriod,
long timeout,
TimeUnit unit)
Signals this executor that the caller wants the executor to be shut down.
|
List<Runnable> |
shutdownNow() |
<T> Future<T> |
submit(Callable<T> task) |
Future<?> |
submit(Runnable task) |
<T> Future<T> |
submit(Runnable task,
T result) |
Future<?> |
terminationFuture()
Returns the
Future which is notified when all EventExecutor s managed by this
EventExecutorGroup have been terminated. |
getContinueExistingPeriodicTasksAfterShutdownPolicy, getExecuteExistingDelayedTasksAfterShutdownPolicy, getQueue, getRemoveOnCancelPolicy, setContinueExistingPeriodicTasksAfterShutdownPolicy, setExecuteExistingDelayedTasksAfterShutdownPolicy, setRemoveOnCancelPolicy
afterExecute, allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, beforeExecute, finalize, getActiveCount, getCompletedTaskCount, getCorePoolSize, getKeepAliveTime, getLargestPoolSize, getMaximumPoolSize, getPoolSize, getRejectedExecutionHandler, getTaskCount, getThreadFactory, isShutdown, isTerminated, isTerminating, prestartAllCoreThreads, prestartCoreThread, purge, remove, setCorePoolSize, setKeepAliveTime, setMaximumPoolSize, setRejectedExecutionHandler, setThreadFactory, terminated, toString
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
awaitTermination, invokeAll, invokeAll, invokeAny, invokeAny, isShutdown, isTerminated
forEach, spliterator
public UnorderedThreadPoolEventExecutor(int corePoolSize)
public UnorderedThreadPoolEventExecutor(int corePoolSize, ThreadFactory threadFactory)
public UnorderedThreadPoolEventExecutor(int corePoolSize, RejectedExecutionHandler handler)
public UnorderedThreadPoolEventExecutor(int corePoolSize, ThreadFactory threadFactory, RejectedExecutionHandler handler)
public EventExecutor next()
EventExecutor
next
in interface EventExecutor
next
in interface EventExecutorGroup
public EventExecutorGroup parent()
EventExecutor
EventExecutorGroup
which is the parent of this EventExecutor
,parent
in interface EventExecutor
public boolean inEventLoop()
EventExecutor
EventExecutor.inEventLoop(Thread)
with Thread.currentThread()
as argumentinEventLoop
in interface EventExecutor
public boolean inEventLoop(Thread thread)
EventExecutor
inEventLoop
in interface EventExecutor
public <V> Promise<V> newPromise()
EventExecutor
Promise
.newPromise
in interface EventExecutor
public <V> ProgressivePromise<V> newProgressivePromise()
EventExecutor
ProgressivePromise
.newProgressivePromise
in interface EventExecutor
public <V> Future<V> newSucceededFuture(V result)
EventExecutor
Future
which is marked as succeeded already. So Future.isSuccess()
will return true
. All FutureListener
added to it will be notified directly. Also
every call of blocking methods will just return without blocking.newSucceededFuture
in interface EventExecutor
public <V> Future<V> newFailedFuture(Throwable cause)
EventExecutor
Future
which is marked as failed already. So Future.isSuccess()
will return false
. All FutureListener
added to it will be notified directly. Also
every call of blocking methods will just return without blocking.newFailedFuture
in interface EventExecutor
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
in interface EventExecutorGroup
public List<Runnable> shutdownNow()
shutdownNow
in interface EventExecutorGroup
shutdownNow
in interface ExecutorService
shutdownNow
in class ScheduledThreadPoolExecutor
public void shutdown()
shutdown
in interface EventExecutorGroup
shutdown
in interface ExecutorService
shutdown
in class ScheduledThreadPoolExecutor
public Future<?> shutdownGracefully()
EventExecutorGroup
EventExecutorGroup.shutdownGracefully(long, long, TimeUnit)
with sensible default values.shutdownGracefully
in interface EventExecutorGroup
EventExecutorGroup.terminationFuture()
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.shutdownGracefully
in interface 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
in interface EventExecutorGroup
public Iterator<EventExecutor> iterator()
iterator
in interface EventExecutorGroup
iterator
in interface Iterable<EventExecutor>
protected <V> RunnableScheduledFuture<V> decorateTask(Runnable runnable, RunnableScheduledFuture<V> task)
decorateTask
in class ScheduledThreadPoolExecutor
protected <V> RunnableScheduledFuture<V> decorateTask(Callable<V> callable, RunnableScheduledFuture<V> task)
decorateTask
in class ScheduledThreadPoolExecutor
public ScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit)
schedule
in interface EventExecutorGroup
schedule
in interface ScheduledExecutorService
schedule
in class ScheduledThreadPoolExecutor
public <V> ScheduledFuture<V> schedule(Callable<V> callable, long delay, TimeUnit unit)
schedule
in interface EventExecutorGroup
schedule
in interface ScheduledExecutorService
schedule
in class ScheduledThreadPoolExecutor
public ScheduledFuture<?> scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit)
scheduleAtFixedRate
in interface EventExecutorGroup
scheduleAtFixedRate
in interface ScheduledExecutorService
scheduleAtFixedRate
in class ScheduledThreadPoolExecutor
public ScheduledFuture<?> scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit)
scheduleWithFixedDelay
in interface EventExecutorGroup
scheduleWithFixedDelay
in interface ScheduledExecutorService
scheduleWithFixedDelay
in class ScheduledThreadPoolExecutor
public Future<?> submit(Runnable task)
submit
in interface EventExecutorGroup
submit
in interface ExecutorService
submit
in class ScheduledThreadPoolExecutor
public <T> Future<T> submit(Runnable task, T result)
submit
in interface EventExecutorGroup
submit
in interface ExecutorService
submit
in class ScheduledThreadPoolExecutor
public <T> Future<T> submit(Callable<T> task)
submit
in interface EventExecutorGroup
submit
in interface ExecutorService
submit
in class ScheduledThreadPoolExecutor
public void execute(Runnable command)
execute
in interface Executor
execute
in class ScheduledThreadPoolExecutor
Copyright © 2008–2024 The Netty Project. All rights reserved.