Interface EventExecutor
- All Superinterfaces:
EventExecutorGroup, Executor, ExecutorService, Iterable<EventExecutor>, ScheduledExecutorService, ThreadAwareExecutor
- All Known Subinterfaces:
EventLoop, IoEventLoop, OrderedEventExecutor
- All Known Implementing Classes:
AbstractEventExecutor, AbstractEventLoop, AbstractScheduledEventExecutor, DefaultEventExecutor, DefaultEventLoop, EpollEventLoop, GlobalEventExecutor, ImmediateEventExecutor, ManualIoEventLoop, NioEventLoop, SingleThreadEventExecutor, SingleThreadEventLoop, SingleThreadIoEventLoop, ThreadPerChannelEventLoop, UnorderedThreadPoolEventExecutor
The
EventExecutor is a special EventExecutorGroup which comes
with some handy methods to see if a Thread is executed in a event loop.
Besides this, it also extends the EventExecutorGroup to allow for a generic
way to access methods.-
Method Summary
Modifier and TypeMethodDescriptiondefault booleanCallsinEventLoop(Thread)withThread.currentThread()as argumentbooleaninEventLoop(Thread thread) default booleanisExecutorThread(Thread thread) default booleanReturnstrueif theEventExecutoris considered suspended.default <V> Future<V> newFailedFuture(Throwable cause) Create a newFuturewhich is marked as failed already.default <V> ProgressivePromise<V> Create a newProgressivePromise.default <V> Promise<V> Return a newPromise.default <V> Future<V> newSucceededFuture(V result) Create a newFuturewhich is marked as succeeded already.parent()Return theEventExecutorGroupwhich is the parent of thisEventExecutor,default booleanTry to suspend thisEventExecutorand returntrueif suspension was successful.Methods inherited from interface EventExecutorGroup
isShuttingDown, iterator, next, schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelay, shutdown, shutdownGracefully, shutdownGracefully, shutdownNow, submit, submit, submit, terminationFuture, tickerMethods inherited from interface ExecutorService
awaitTermination, invokeAll, invokeAll, invokeAny, invokeAny, isShutdown, isTerminatedMethods inherited from interface Iterable
forEach, spliterator
-
Method Details
-
parent
EventExecutorGroup parent()Return theEventExecutorGroupwhich is the parent of thisEventExecutor, -
isExecutorThread
Description copied from interface:ThreadAwareExecutor- Specified by:
isExecutorThreadin interfaceThreadAwareExecutor
-
inEventLoop
default boolean inEventLoop()CallsinEventLoop(Thread)withThread.currentThread()as argument -
inEventLoop
-
newPromise
-
newProgressivePromise
Create a newProgressivePromise. -
newSucceededFuture
Create a newFuturewhich is marked as succeeded already. SoFuture.isSuccess()will returntrue. AllFutureListeneradded to it will be notified directly. Also every call of blocking methods will just return without blocking. -
newFailedFuture
Create a newFuturewhich is marked as failed already. SoFuture.isSuccess()will returnfalse. AllFutureListeneradded to it will be notified directly. Also every call of blocking methods will just return without blocking. -
isSuspended
default boolean isSuspended()Returnstrueif theEventExecutoris considered suspended.- Returns:
trueif suspended,falseotherwise.
-
trySuspend
default boolean trySuspend()Try to suspend thisEventExecutorand returntrueif suspension was successful. Suspending anEventExecutorwill allow it to free up resources, like for example aThreadthat is backing theEventExecutor. Once anEventExecutorwas suspended it will be started again by submitting work to it via one of the following methods:Executor.execute(Runnable)EventExecutorGroup.schedule(Runnable, long, TimeUnit)EventExecutorGroup.schedule(Callable, long, TimeUnit)EventExecutorGroup.scheduleAtFixedRate(Runnable, long, long, TimeUnit)EventExecutorGroup.scheduleWithFixedDelay(Runnable, long, long, TimeUnit)
trueit might take some time for theEventExecutorto fully suspend itself.- Returns:
trueif suspension was successful, otherwisefalse.
-