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
TheEventExecutor
is a specialEventExecutorGroup
which comes with some handy methods to see if aThread
is executed in a event loop. Besides this, it also extends theEventExecutorGroup
to allow for a generic way to access methods.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default boolean
inEventLoop()
CallsinEventLoop(Thread)
withThread.currentThread()
as argumentboolean
inEventLoop(java.lang.Thread thread)
Returntrue
if the givenThread
is executed in the event loop,false
otherwise.default boolean
isExecutorThread(java.lang.Thread thread)
default boolean
isSuspended()
Returnstrue
if theEventExecutor
is considered suspended.default <V> Future<V>
newFailedFuture(java.lang.Throwable cause)
Create a newFuture
which 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 newFuture
which is marked as succeeded already.EventExecutorGroup
parent()
Return theEventExecutorGroup
which is the parent of thisEventExecutor
,default boolean
trySuspend()
Try to suspend thisEventExecutor
and returntrue
if 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
-
-
-
-
Method Detail
-
parent
EventExecutorGroup parent()
Return theEventExecutorGroup
which is the parent of thisEventExecutor
,
-
isExecutorThread
default boolean isExecutorThread(java.lang.Thread thread)
Description copied from interface:ThreadAwareExecutor
- Specified by:
isExecutorThread
in interfaceThreadAwareExecutor
-
inEventLoop
default boolean inEventLoop()
CallsinEventLoop(Thread)
withThread.currentThread()
as argument
-
inEventLoop
boolean inEventLoop(java.lang.Thread thread)
Returntrue
if the givenThread
is executed in the event loop,false
otherwise.
-
newProgressivePromise
default <V> ProgressivePromise<V> newProgressivePromise()
Create a newProgressivePromise
.
-
newSucceededFuture
default <V> Future<V> newSucceededFuture(V result)
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.
-
newFailedFuture
default <V> Future<V> newFailedFuture(java.lang.Throwable cause)
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.
-
isSuspended
default boolean isSuspended()
Returnstrue
if theEventExecutor
is considered suspended.- Returns:
true
if suspended,false
otherwise.
-
trySuspend
default boolean trySuspend()
Try to suspend thisEventExecutor
and returntrue
if suspension was successful. Suspending anEventExecutor
will allow it to free up resources, like for example aThread
that is backing theEventExecutor
. Once anEventExecutor
was 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)
true
it might take some time for theEventExecutor
to fully suspend itself.- Returns:
true
if suspension was successful, otherwisefalse
.
-
-