Package io.netty.util.concurrent
Interface EventExecutor
-
- All Superinterfaces:
EventExecutorGroup,java.util.concurrent.Executor,java.util.concurrent.ExecutorService,java.lang.Iterable<EventExecutor>,java.util.concurrent.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
public interface EventExecutor extends EventExecutorGroup, ThreadAwareExecutor
TheEventExecutoris a specialEventExecutorGroupwhich comes with some handy methods to see if aThreadis executed in a event loop. Besides this, it also extends theEventExecutorGroupto allow for a generic way to access methods.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default booleaninEventLoop()CallsinEventLoop(Thread)withThread.currentThread()as argumentbooleaninEventLoop(java.lang.Thread thread)Returntrueif the givenThreadis executed in the event loop,falseotherwise.default booleanisExecutorThread(java.lang.Thread thread)default booleanisSuspended()Returnstrueif theEventExecutoris considered suspended.default <V> Future<V>newFailedFuture(java.lang.Throwable cause)Create a newFuturewhich is marked as failed already.default <V> ProgressivePromise<V>newProgressivePromise()Create a newProgressivePromise.default <V> Promise<V>newPromise()Return a newPromise.default <V> Future<V>newSucceededFuture(V result)Create a newFuturewhich is marked as succeeded already.EventExecutorGroupparent()Return theEventExecutorGroupwhich is the parent of thisEventExecutor,default booleantrySuspend()Try to suspend thisEventExecutorand returntrueif suspension was successful.-
Methods inherited from interface io.netty.util.concurrent.EventExecutorGroup
isShuttingDown, iterator, next, schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelay, shutdown, shutdownGracefully, shutdownGracefully, shutdownNow, submit, submit, submit, terminationFuture, ticker
-
-
-
-
Method Detail
-
parent
EventExecutorGroup parent()
Return theEventExecutorGroupwhich is the parent of thisEventExecutor,
-
isExecutorThread
default boolean isExecutorThread(java.lang.Thread thread)
Description copied from interface:ThreadAwareExecutor- Specified by:
isExecutorThreadin interfaceThreadAwareExecutor
-
inEventLoop
default boolean inEventLoop()
CallsinEventLoop(Thread)withThread.currentThread()as argument
-
inEventLoop
boolean inEventLoop(java.lang.Thread thread)
Returntrueif the givenThreadis executed in the event loop,falseotherwise.
-
newProgressivePromise
default <V> ProgressivePromise<V> newProgressivePromise()
Create a newProgressivePromise.
-
newSucceededFuture
default <V> Future<V> newSucceededFuture(V result)
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
default <V> Future<V> newFailedFuture(java.lang.Throwable cause)
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.
-
-