Top Description Methods
io.netty5.util.concurrent

public Interface EventExecutor

extends EventExecutorGroup, FuturePromiseFactory
Known Direct Subinterfaces
io.netty5.util.concurrent.OrderedEventExecutor
Known Direct Implementers
io.netty5.util.concurrent.UnorderedThreadPoolEventExecutor, io.netty5.util.concurrent.AbstractEventExecutor
Imports
java.util.Collections, .Iterator, java.util.concurrent.Callable, .TimeUnit

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 TypeMethod and Description
public void
execute(Runnable
the runnable task
task
)

Redeclares as abstract: io.netty5.util.concurrent.EventExecutorGroup.execute.

Executes the given command at some time in the future.
public default boolean
public boolean
inEventLoop(Thread thread)

Return true if the given Thread is executed in the event loop, false otherwise.

public default Iterator<EventExecutor>
iterator()

Implements io.netty5.util.concurrent.EventExecutorGroup.iterator.

Returns an iterator over elements of type T.
public default <V> Future<V>
newFailedFuture(Throwable cause)

Overrides default io.netty5.util.concurrent.FuturePromiseFactory.newFailedFuture.

Create a new Future which is marked as failed already.
public default <V> Promise<V>
public default <V> Future<V>
newSucceededFuture(V result)

Overrides default io.netty5.util.concurrent.FuturePromiseFactory.newSucceededFuture.

Create a new Future which is marked as succeeded already.
public default EventExecutor
next()

Implements io.netty5.util.concurrent.EventExecutorGroup.next.

Returns a reference to itself.
public Future<Void>
schedule(Runnable
The task that should be executed in this EventExecutorGroup after the given delay.
task
,
long
A positive time delay, in the given time unit.
delay
,
TimeUnit
The non-null time unit for the delay.
unit
)

Redeclares as abstract: io.netty5.util.concurrent.EventExecutorGroup.schedule.

Schedule the given task for execution after the given delay, in the next available EventExecutor in this group, and return a future that produces a null result when the task completes.
public <V> Future<V>
schedule(Callable<V>
The task that should be executed in this EventExecutorGroup after the given delay.
task
,
long
A positive time delay, in the given time unit.
delay
,
TimeUnit
The non-null time unit for the delay.
unit
)

Redeclares as abstract: io.netty5.util.concurrent.EventExecutorGroup.schedule.

Schedule the given task for execution after the given delay, in the next available EventExecutor in this group, and return a future that will return the result of the callable when the task completes.
public Future<Void>
scheduleAtFixedRate(Runnable
The task that should be scheduled to execute at a fixed rate in this EventExecutorGroup.
task
,
long
The positive initial delay for the first task execution, in terms of the given time unit.
initialDelay
,
long
The positive period for the execution frequency to use after the first execution has started, in terms of the given time unit.
period
,
TimeUnit
The non-null time unit for the delay and period.
unit
)

Redeclares as abstract: io.netty5.util.concurrent.EventExecutorGroup.scheduleAtFixedRate.

Schedule the given task for periodic execution in the next available EventExecutor.
public Future<Void>
scheduleWithFixedDelay(Runnable
The task that should be scheduled to execute with fixed delays in this EventExecutorGroup.
task
,
long
The positive initial delay for the first task execution, in terms of the given time unit.
initialDelay
,
long
The positive subsequent delay between task, to use after the first execution has completed, in terms of the given time unit.
delay
,
TimeUnit
The non-null time unit for the delays.
unit
)

Redeclares as abstract: io.netty5.util.concurrent.EventExecutorGroup.scheduleWithFixedDelay.

Schedule the given task for periodic execution in the next available EventExecutor.
public Future<Void>
submit(Runnable
The task that should be executed in this EventExecutorGroup.
task
)

Redeclares as abstract: io.netty5.util.concurrent.EventExecutorGroup.submit.

Submit the given task for execution in the next available EventExecutor in this group, and return a future that produces a null result when the task completes.
public <T> Future<T>
submit(Runnable
The task that should be executed in this EventExecutorGroup.
task
,
T
The value that the returned future will complete with, if the task completes successfully.
result
)

Redeclares as abstract: io.netty5.util.concurrent.EventExecutorGroup.submit.

Submit the given task for execution in the next available EventExecutor in this group, and return a future that produces the given result when the task completes.
public <T> Future<T>
submit(Callable<T>
The task that should be executed in this EventExecutorGroup.
task
)

Redeclares as abstract: io.netty5.util.concurrent.EventExecutorGroup.submit.

Submit the given task for execution in the next available EventExecutor in this group, and return a future that will return the result of the callable when the task completes.
Inherited from io.netty5.util.concurrent.EventExecutorGroup:
awaitTerminationisShutdownisShuttingDownisTerminatedshutdownGracefullyshutdownGracefullyterminationFuture
Inherited from io.netty5.util.concurrent.FuturePromiseFactory:
newSucceededFuture

Method Detail

executeback to summary
public void execute(Runnable task)

Redeclares as abstract: io.netty5.util.concurrent.EventExecutorGroup.execute.

Doc from java.util.concurrent.Executor.execute.

Executes the given command at some time in the future. The command may execute in a new thread, in a pooled thread, or in the calling thread, at the discretion of the Executor implementation.

Parameters
task:Runnable

the runnable task

Annotations
@Override
inEventLoopback to summary
public default boolean inEventLoop()

Calls inEventLoop(Thread) with Thread#currentThread() as argument

inEventLoopback to summary
public boolean inEventLoop(Thread thread)

Return true if the given Thread is executed in the event loop, false otherwise.

iteratorback to summary
public default Iterator<EventExecutor> iterator()

Implements io.netty5.util.concurrent.EventExecutorGroup.iterator.

Doc from java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

Returns:Iterator<EventExecutor>

an Iterator.

Annotations
@Override
newFailedFutureback to summary
public default <V> Future<V> newFailedFuture(Throwable cause)

Overrides default io.netty5.util.concurrent.FuturePromiseFactory.newFailedFuture.

Create a new 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.

newPromiseback to summary
public default <V> Promise<V> newPromise()

Implements io.netty5.util.concurrent.FuturePromiseFactory.newPromise.

Return a new Promise.

newSucceededFutureback to summary
public default <V> Future<V> newSucceededFuture(V result)

Overrides default io.netty5.util.concurrent.FuturePromiseFactory.newSucceededFuture.

Create a new 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.

nextback to summary
public default EventExecutor next()

Implements io.netty5.util.concurrent.EventExecutorGroup.next.

Returns a reference to itself.

Annotations
@Override
scheduleback to summary
public Future<Void> schedule(Runnable task, long delay, TimeUnit unit)

Redeclares as abstract: io.netty5.util.concurrent.EventExecutorGroup.schedule.

Doc from io.netty5.util.concurrent.EventExecutorGroup.schedule.

Schedule the given task for execution after the given delay, in the next available EventExecutor in this group, and return a future that produces a null result when the task completes.

Parameters
task:Runnable

The task that should be executed in this EventExecutorGroup after the given delay.

delay:long

A positive time delay, in the given time unit.

unit:TimeUnit

The non-null time unit for the delay.

Returns:Future<Void>

A future that represents the completion of the scheduled task.

Annotations
@Override
scheduleback to summary
public <V> Future<V> schedule(Callable<V> task, long delay, TimeUnit unit)

Redeclares as abstract: io.netty5.util.concurrent.EventExecutorGroup.schedule.

Doc from io.netty5.util.concurrent.EventExecutorGroup.schedule.

Schedule the given task for execution after the given delay, in the next available EventExecutor in this group, and return a future that will return the result of the callable when the task completes.

Parameters
<V>
The type of the future result.
task:Callable<V>

The task that should be executed in this EventExecutorGroup after the given delay.

delay:long

A positive time delay, in the given time unit.

unit:TimeUnit

The non-null time unit for the delay.

Returns:Future<V>

A future that represents the completion of the scheduled task.

Annotations
@Override
scheduleAtFixedRateback to summary
public Future<Void> scheduleAtFixedRate(Runnable task, long initialDelay, long period, TimeUnit unit)

Redeclares as abstract: io.netty5.util.concurrent.EventExecutorGroup.scheduleAtFixedRate.

Doc from io.netty5.util.concurrent.EventExecutorGroup.scheduleAtFixedRate.

Schedule the given task for periodic execution in the next available EventExecutor. The first execution will occur after the given initial delay, and the following repeated executions will occur with the given period of time between each execution is started. If the task takes longer to complete than the requested period, then the following executions will be delayed, rather than allowing multiple instances of the task to run concurrently.

The task will be executed repeatedly until it either fails with an exception, or its future is cancelled. The future thus will never complete successfully.

Parameters
task:Runnable

The task that should be scheduled to execute at a fixed rate in this EventExecutorGroup.

initialDelay:long

The positive initial delay for the first task execution, in terms of the given time unit.

period:long

The positive period for the execution frequency to use after the first execution has started, in terms of the given time unit.

unit:TimeUnit

The non-null time unit for the delay and period.

Returns:Future<Void>

A future that represents the recurring task, and which can be cancelled to stop future executions.

Annotations
@Override
scheduleWithFixedDelayback to summary
public Future<Void> scheduleWithFixedDelay(Runnable task, long initialDelay, long delay, TimeUnit unit)

Redeclares as abstract: io.netty5.util.concurrent.EventExecutorGroup.scheduleWithFixedDelay.

Doc from io.netty5.util.concurrent.EventExecutorGroup.scheduleWithFixedDelay.

Schedule the given task for periodic execution in the next available EventExecutor. The first execution will occur after the given initial delay, and the following repeated executions will occur with the given subsequent delay between one task completing and the next task starting. The delay from the completion of one task, to the start of the next, stays unchanged regardless of how long a task takes to complete.

This is in contrast to scheduleAtFixedRate(Runnable, long, long, TimeUnit) which varies the delays between the tasks in order to hit a given frequency.

The task will be executed repeatedly until it either fails with an exception, or its future is cancelled. The future thus will never complete successfully.

Parameters
task:Runnable

The task that should be scheduled to execute with fixed delays in this EventExecutorGroup.

initialDelay:long

The positive initial delay for the first task execution, in terms of the given time unit.

delay:long

The positive subsequent delay between task, to use after the first execution has completed, in terms of the given time unit.

unit:TimeUnit

The non-null time unit for the delays.

Returns:Future<Void>

A future that represents the recurring task, and which can be cancelled to stop future executions.

Annotations
@Override
submitback to summary
public Future<Void> submit(Runnable task)

Redeclares as abstract: io.netty5.util.concurrent.EventExecutorGroup.submit.

Doc from io.netty5.util.concurrent.EventExecutorGroup.submit.

Submit the given task for execution in the next available EventExecutor in this group, and return a future that produces a null result when the task completes.

Parameters
task:Runnable

The task that should be executed in this EventExecutorGroup.

Returns:Future<Void>

A future that represents the completion of the submitted task.

Annotations
@Override
submitback to summary
public <T> Future<T> submit(Runnable task, T result)

Redeclares as abstract: io.netty5.util.concurrent.EventExecutorGroup.submit.

Doc from io.netty5.util.concurrent.EventExecutorGroup.submit.

Submit the given task for execution in the next available EventExecutor in this group, and return a future that produces the given result when the task completes.

Parameters
<T>
The type of the future result.
task:Runnable

The task that should be executed in this EventExecutorGroup.

result:T

The value that the returned future will complete with, if the task completes successfully.

Returns:Future<T>

A future that represents the completion of the submitted task.

Annotations
@Override
submitback to summary
public <T> Future<T> submit(Callable<T> task)

Redeclares as abstract: io.netty5.util.concurrent.EventExecutorGroup.submit.

Doc from io.netty5.util.concurrent.EventExecutorGroup.submit.

Submit the given task for execution in the next available EventExecutor in this group, and return a future that will return the result of the callable when the task completes.

Parameters
<T>
The type of the future result.
task:Callable<T>

The task that should be executed in this EventExecutorGroup.

Returns:Future<T>

A future that represents the completion of the submitted task.

Annotations
@Override