Package io.netty.util.concurrent
Class UnorderedThreadPoolEventExecutor
- java.lang.Object
-
- java.util.concurrent.AbstractExecutorService
-
- java.util.concurrent.ThreadPoolExecutor
-
- java.util.concurrent.ScheduledThreadPoolExecutor
-
- io.netty.util.concurrent.UnorderedThreadPoolEventExecutor
-
- All Implemented Interfaces:
EventExecutor
,EventExecutorGroup
,ThreadAwareExecutor
,java.lang.Iterable<EventExecutor>
,java.util.concurrent.Executor
,java.util.concurrent.ExecutorService
,java.util.concurrent.ScheduledExecutorService
@Deprecated public final class UnorderedThreadPoolEventExecutor extends java.util.concurrent.ScheduledThreadPoolExecutor implements EventExecutor
Deprecated.The behavior of this event executor deviates from the typical Netty execution model and can cause subtle issues as a result. Applications that wish to process messages with greater parallelism, should instead do explicit off-loading to their own thread-pools.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!
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.concurrent.ThreadPoolExecutor
java.util.concurrent.ThreadPoolExecutor.AbortPolicy, java.util.concurrent.ThreadPoolExecutor.CallerRunsPolicy, java.util.concurrent.ThreadPoolExecutor.DiscardOldestPolicy, java.util.concurrent.ThreadPoolExecutor.DiscardPolicy
-
-
Constructor Summary
Constructors Constructor Description UnorderedThreadPoolEventExecutor(int corePoolSize)
Deprecated.UnorderedThreadPoolEventExecutor(int corePoolSize, java.util.concurrent.RejectedExecutionHandler handler)
Deprecated.UnorderedThreadPoolEventExecutor(int corePoolSize, java.util.concurrent.ThreadFactory threadFactory)
Deprecated.SeeScheduledThreadPoolExecutor(int, ThreadFactory)
UnorderedThreadPoolEventExecutor(int corePoolSize, java.util.concurrent.ThreadFactory threadFactory, java.util.concurrent.RejectedExecutionHandler handler)
Deprecated.SeeScheduledThreadPoolExecutor(int, ThreadFactory, RejectedExecutionHandler)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected <V> java.util.concurrent.RunnableScheduledFuture<V>
decorateTask(java.lang.Runnable runnable, java.util.concurrent.RunnableScheduledFuture<V> task)
Deprecated.protected <V> java.util.concurrent.RunnableScheduledFuture<V>
decorateTask(java.util.concurrent.Callable<V> callable, java.util.concurrent.RunnableScheduledFuture<V> task)
Deprecated.void
execute(java.lang.Runnable command)
Deprecated.boolean
inEventLoop()
Deprecated.CallsEventExecutor.inEventLoop(Thread)
withThread.currentThread()
as argumentboolean
inEventLoop(java.lang.Thread thread)
Deprecated.Returntrue
if the givenThread
is executed in the event loop,false
otherwise.boolean
isShuttingDown()
Deprecated.Returnstrue
if and only if allEventExecutor
s managed by thisEventExecutorGroup
are being shut down gracefully or was shut down.java.util.Iterator<EventExecutor>
iterator()
Deprecated.<V> Future<V>
newFailedFuture(java.lang.Throwable cause)
Deprecated.Create a newFuture
which is marked as failed already.<V> ProgressivePromise<V>
newProgressivePromise()
Deprecated.Create a newProgressivePromise
.<V> Promise<V>
newPromise()
Deprecated.Return a newPromise
.<V> Future<V>
newSucceededFuture(V result)
Deprecated.Create a newFuture
which is marked as succeeded already.EventExecutor
next()
Deprecated.Returns one of theEventExecutor
s managed by thisEventExecutorGroup
.EventExecutorGroup
parent()
Deprecated.Return theEventExecutorGroup
which is the parent of thisEventExecutor
,ScheduledFuture<?>
schedule(java.lang.Runnable command, long delay, java.util.concurrent.TimeUnit unit)
Deprecated.<V> ScheduledFuture<V>
schedule(java.util.concurrent.Callable<V> callable, long delay, java.util.concurrent.TimeUnit unit)
Deprecated.ScheduledFuture<?>
scheduleAtFixedRate(java.lang.Runnable command, long initialDelay, long period, java.util.concurrent.TimeUnit unit)
Deprecated.ScheduledFuture<?>
scheduleWithFixedDelay(java.lang.Runnable command, long initialDelay, long delay, java.util.concurrent.TimeUnit unit)
Deprecated.void
shutdown()
Deprecated.Future<?>
shutdownGracefully()
Deprecated.Shortcut method forEventExecutorGroup.shutdownGracefully(long, long, TimeUnit)
with sensible default values.Future<?>
shutdownGracefully(long quietPeriod, long timeout, java.util.concurrent.TimeUnit unit)
Deprecated.Signals this executor that the caller wants the executor to be shut down.java.util.List<java.lang.Runnable>
shutdownNow()
Deprecated.Future<?>
submit(java.lang.Runnable task)
Deprecated.<T> Future<T>
submit(java.lang.Runnable task, T result)
Deprecated.<T> Future<T>
submit(java.util.concurrent.Callable<T> task)
Deprecated.Future<?>
terminationFuture()
Deprecated.Returns theFuture
which is notified when allEventExecutor
s managed by thisEventExecutorGroup
have been terminated.-
Methods inherited from class java.util.concurrent.ScheduledThreadPoolExecutor
getContinueExistingPeriodicTasksAfterShutdownPolicy, getExecuteExistingDelayedTasksAfterShutdownPolicy, getQueue, getRemoveOnCancelPolicy, setContinueExistingPeriodicTasksAfterShutdownPolicy, setExecuteExistingDelayedTasksAfterShutdownPolicy, setRemoveOnCancelPolicy
-
Methods inherited from class java.util.concurrent.ThreadPoolExecutor
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
-
Methods inherited from class java.util.concurrent.AbstractExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor
-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.netty.util.concurrent.EventExecutor
isExecutorThread, isSuspended, trySuspend
-
-
-
-
Constructor Detail
-
UnorderedThreadPoolEventExecutor
public UnorderedThreadPoolEventExecutor(int corePoolSize)
Deprecated.
-
UnorderedThreadPoolEventExecutor
public UnorderedThreadPoolEventExecutor(int corePoolSize, java.util.concurrent.ThreadFactory threadFactory)
Deprecated.SeeScheduledThreadPoolExecutor(int, ThreadFactory)
-
UnorderedThreadPoolEventExecutor
public UnorderedThreadPoolEventExecutor(int corePoolSize, java.util.concurrent.RejectedExecutionHandler handler)
Deprecated.
-
UnorderedThreadPoolEventExecutor
public UnorderedThreadPoolEventExecutor(int corePoolSize, java.util.concurrent.ThreadFactory threadFactory, java.util.concurrent.RejectedExecutionHandler handler)
Deprecated.SeeScheduledThreadPoolExecutor(int, ThreadFactory, RejectedExecutionHandler)
-
-
Method Detail
-
next
public EventExecutor next()
Deprecated.Description copied from interface:EventExecutorGroup
Returns one of theEventExecutor
s managed by thisEventExecutorGroup
.- Specified by:
next
in interfaceEventExecutorGroup
-
parent
public EventExecutorGroup parent()
Deprecated.Description copied from interface:EventExecutor
Return theEventExecutorGroup
which is the parent of thisEventExecutor
,- Specified by:
parent
in interfaceEventExecutor
-
inEventLoop
public boolean inEventLoop()
Deprecated.Description copied from interface:EventExecutor
CallsEventExecutor.inEventLoop(Thread)
withThread.currentThread()
as argument- Specified by:
inEventLoop
in interfaceEventExecutor
-
inEventLoop
public boolean inEventLoop(java.lang.Thread thread)
Deprecated.Description copied from interface:EventExecutor
Returntrue
if the givenThread
is executed in the event loop,false
otherwise.- Specified by:
inEventLoop
in interfaceEventExecutor
-
newPromise
public <V> Promise<V> newPromise()
Deprecated.Description copied from interface:EventExecutor
Return a newPromise
.- Specified by:
newPromise
in interfaceEventExecutor
-
newProgressivePromise
public <V> ProgressivePromise<V> newProgressivePromise()
Deprecated.Description copied from interface:EventExecutor
Create a newProgressivePromise
.- Specified by:
newProgressivePromise
in interfaceEventExecutor
-
newSucceededFuture
public <V> Future<V> newSucceededFuture(V result)
Deprecated.Description copied from interface:EventExecutor
Create a newFuture
which is marked as succeeded already. SoFuture.isSuccess()
will returntrue
. AllFutureListener
added to it will be notified directly. Also every call of blocking methods will just return without blocking.- Specified by:
newSucceededFuture
in interfaceEventExecutor
-
newFailedFuture
public <V> Future<V> newFailedFuture(java.lang.Throwable cause)
Deprecated.Description copied from interface:EventExecutor
Create a newFuture
which is marked as failed already. SoFuture.isSuccess()
will returnfalse
. AllFutureListener
added to it will be notified directly. Also every call of blocking methods will just return without blocking.- Specified by:
newFailedFuture
in interfaceEventExecutor
-
isShuttingDown
public boolean isShuttingDown()
Deprecated.Description copied from interface:EventExecutorGroup
Returnstrue
if and only if allEventExecutor
s managed by thisEventExecutorGroup
are being shut down gracefully or was shut down.- Specified by:
isShuttingDown
in interfaceEventExecutorGroup
-
shutdownNow
public java.util.List<java.lang.Runnable> shutdownNow()
Deprecated.- Specified by:
shutdownNow
in interfaceEventExecutorGroup
- Specified by:
shutdownNow
in interfacejava.util.concurrent.ExecutorService
- Overrides:
shutdownNow
in classjava.util.concurrent.ScheduledThreadPoolExecutor
-
shutdown
public void shutdown()
Deprecated.- Specified by:
shutdown
in interfaceEventExecutorGroup
- Specified by:
shutdown
in interfacejava.util.concurrent.ExecutorService
- Overrides:
shutdown
in classjava.util.concurrent.ScheduledThreadPoolExecutor
-
shutdownGracefully
public Future<?> shutdownGracefully()
Deprecated.Description copied from interface:EventExecutorGroup
Shortcut method forEventExecutorGroup.shutdownGracefully(long, long, TimeUnit)
with sensible default values.- Specified by:
shutdownGracefully
in interfaceEventExecutorGroup
- Returns:
- the
EventExecutorGroup.terminationFuture()
-
shutdownGracefully
public Future<?> shutdownGracefully(long quietPeriod, long timeout, java.util.concurrent.TimeUnit unit)
Deprecated.Description copied from interface:EventExecutorGroup
Signals this executor that the caller wants the executor to be shut down. Once this method is called,EventExecutorGroup.isShuttingDown()
starts to returntrue
, and the executor prepares to shut itself down. UnlikeEventExecutorGroup.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.- Specified by:
shutdownGracefully
in interfaceEventExecutorGroup
- Parameters:
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 ofquietPeriod
andtimeout
- Returns:
- the
EventExecutorGroup.terminationFuture()
-
terminationFuture
public Future<?> terminationFuture()
Deprecated.Description copied from interface:EventExecutorGroup
Returns theFuture
which is notified when allEventExecutor
s managed by thisEventExecutorGroup
have been terminated.- Specified by:
terminationFuture
in interfaceEventExecutorGroup
-
iterator
public java.util.Iterator<EventExecutor> iterator()
Deprecated.- Specified by:
iterator
in interfaceEventExecutorGroup
- Specified by:
iterator
in interfacejava.lang.Iterable<EventExecutor>
-
decorateTask
protected <V> java.util.concurrent.RunnableScheduledFuture<V> decorateTask(java.lang.Runnable runnable, java.util.concurrent.RunnableScheduledFuture<V> task)
Deprecated.- Overrides:
decorateTask
in classjava.util.concurrent.ScheduledThreadPoolExecutor
-
decorateTask
protected <V> java.util.concurrent.RunnableScheduledFuture<V> decorateTask(java.util.concurrent.Callable<V> callable, java.util.concurrent.RunnableScheduledFuture<V> task)
Deprecated.- Overrides:
decorateTask
in classjava.util.concurrent.ScheduledThreadPoolExecutor
-
schedule
public ScheduledFuture<?> schedule(java.lang.Runnable command, long delay, java.util.concurrent.TimeUnit unit)
Deprecated.- Specified by:
schedule
in interfaceEventExecutorGroup
- Specified by:
schedule
in interfacejava.util.concurrent.ScheduledExecutorService
- Overrides:
schedule
in classjava.util.concurrent.ScheduledThreadPoolExecutor
-
schedule
public <V> ScheduledFuture<V> schedule(java.util.concurrent.Callable<V> callable, long delay, java.util.concurrent.TimeUnit unit)
Deprecated.- Specified by:
schedule
in interfaceEventExecutorGroup
- Specified by:
schedule
in interfacejava.util.concurrent.ScheduledExecutorService
- Overrides:
schedule
in classjava.util.concurrent.ScheduledThreadPoolExecutor
-
scheduleAtFixedRate
public ScheduledFuture<?> scheduleAtFixedRate(java.lang.Runnable command, long initialDelay, long period, java.util.concurrent.TimeUnit unit)
Deprecated.- Specified by:
scheduleAtFixedRate
in interfaceEventExecutorGroup
- Specified by:
scheduleAtFixedRate
in interfacejava.util.concurrent.ScheduledExecutorService
- Overrides:
scheduleAtFixedRate
in classjava.util.concurrent.ScheduledThreadPoolExecutor
-
scheduleWithFixedDelay
public ScheduledFuture<?> scheduleWithFixedDelay(java.lang.Runnable command, long initialDelay, long delay, java.util.concurrent.TimeUnit unit)
Deprecated.- Specified by:
scheduleWithFixedDelay
in interfaceEventExecutorGroup
- Specified by:
scheduleWithFixedDelay
in interfacejava.util.concurrent.ScheduledExecutorService
- Overrides:
scheduleWithFixedDelay
in classjava.util.concurrent.ScheduledThreadPoolExecutor
-
submit
public Future<?> submit(java.lang.Runnable task)
Deprecated.- Specified by:
submit
in interfaceEventExecutorGroup
- Specified by:
submit
in interfacejava.util.concurrent.ExecutorService
- Overrides:
submit
in classjava.util.concurrent.ScheduledThreadPoolExecutor
-
submit
public <T> Future<T> submit(java.lang.Runnable task, T result)
Deprecated.- Specified by:
submit
in interfaceEventExecutorGroup
- Specified by:
submit
in interfacejava.util.concurrent.ExecutorService
- Overrides:
submit
in classjava.util.concurrent.ScheduledThreadPoolExecutor
-
submit
public <T> Future<T> submit(java.util.concurrent.Callable<T> task)
Deprecated.- Specified by:
submit
in interfaceEventExecutorGroup
- Specified by:
submit
in interfacejava.util.concurrent.ExecutorService
- Overrides:
submit
in classjava.util.concurrent.ScheduledThreadPoolExecutor
-
execute
public void execute(java.lang.Runnable command)
Deprecated.- Specified by:
execute
in interfacejava.util.concurrent.Executor
- Overrides:
execute
in classjava.util.concurrent.ScheduledThreadPoolExecutor
-
-