Top Description Fields Constructors Methods
io.netty5.util.concurrent

public abstract Class AbstractEventExecutor

extends Object
implements EventExecutor
Class Inheritance
All Implemented Interfaces
io.netty5.util.concurrent.EventExecutor, io.netty5.util.concurrent.FuturePromiseFactory, io.netty5.util.concurrent.EventExecutorGroup, java.util.concurrent.Executor, java.lang.Iterable
Known Direct Subclasses
io.netty5.util.concurrent.AbstractScheduledEventExecutor, io.netty5.util.concurrent.ImmediateEventExecutor, io.netty5.util.concurrent.NonStickyEventExecutorGroup.NonStickyOrderedEventExecutor
Imports
io.netty5.util.internal.logging.InternalLogger, .InternalLoggerFactory, java.util.concurrent.Callable, .Executors

Abstract base class for EventExecutor implementations.

Field Summary

Modifier and TypeField and Description
pack-priv static final long
pack-priv static final long
private static final InternalLogger
private final Future<?>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static <V> RunnableFuture<V>
newRunnableFuture(Promise<V> promise, Callable<V> task)

Returns a new RunnableFuture build on top of the given Promise and Callable.

private static <V> RunnableFuture<V>
newRunnableFuture(Promise<V> promise, Runnable task, V value)

Returns a new RunnableFuture build on top of the given Promise and Runnable and value.

public <V> Future<V>
newSucceededFuture(V result)

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

Create a new Future which is marked as succeeded already.
protected <
The type of the result value.
T
>
RunnableFuture<T>

Returns:

The decorated Runnable that is now also a Future.
newTaskFor
(Runnable
The task to be decorated.
runnable
,
T
The value that the returned future will complete with, assuming the given Runnable doesn't throw an exception.
value
)

Decorate the given Runnable and its return value, as a RunnableFuture, such that the returned RunnableFuture completes with the given result at the end of executing its RunnableFuture#run() method.

protected <
The type of the result value.
T
>
RunnableFuture<T>

Returns:

The decorated Runnable that is now also a Future.
newTaskFor
(Callable<T>
The task to be decorated.
callable
)

Decorate the given Callable and its return value, as a RunnableFuture, such that the returned RunnableFuture completes with the returned result from the Callable at the end of executing its RunnableFuture#run() method.

pack-priv static void
safeExecute(Runnable task)

Try to execute the given Runnable and just log if it throws a Throwable.

public final Future<Void>
submit(Runnable
The task that should be executed in this EventExecutorGroup.
task
)

Implements io.netty5.util.concurrent.EventExecutor.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 final <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
)

Implements io.netty5.util.concurrent.EventExecutor.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 final <T> Future<T>
submit(Callable<T>
The task that should be executed in this EventExecutorGroup.
task
)

Implements io.netty5.util.concurrent.EventExecutor.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 java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DEFAULT_SHUTDOWN_QUIET_PERIODback to summary
pack-priv static final long DEFAULT_SHUTDOWN_QUIET_PERIOD
DEFAULT_SHUTDOWN_TIMEOUTback to summary
pack-priv static final long DEFAULT_SHUTDOWN_TIMEOUT
loggerback to summary
private static final InternalLogger logger
successfulVoidFutureback to summary
private final Future<?> successfulVoidFuture

Constructor Detail

AbstractEventExecutorback to summary
public AbstractEventExecutor()

Method Detail

newRunnableFutureback to summary
private static <V> RunnableFuture<V> newRunnableFuture(Promise<V> promise, Callable<V> task)

Returns a new RunnableFuture build on top of the given Promise and Callable. This can be used if you want to override newTaskFor(Callable) and return a different RunnableFuture.

newRunnableFutureback to summary
private static <V> RunnableFuture<V> newRunnableFuture(Promise<V> promise, Runnable task, V value)

Returns a new RunnableFuture build on top of the given Promise and Runnable and value.

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

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

Doc from io.netty5.util.concurrent.EventExecutor.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.

Annotations
@Override
newTaskForback to summary
protected <T> RunnableFuture<T> newTaskFor(Runnable runnable, T value)

Decorate the given Runnable and its return value, as a RunnableFuture, such that the returned RunnableFuture completes with the given result at the end of executing its RunnableFuture#run() method.

The returned RunnableFuture is the task that will actually be run by a thread in this executor.

This method can be overridden by sub-classes to hook into the life cycle of the given task.

Parameters
<T>
The type of the result value.
runnable:Runnable

The task to be decorated.

value:T

The value that the returned future will complete with, assuming the given Runnable doesn't throw an exception.

Returns:RunnableFuture<T>

The decorated Runnable that is now also a Future.

newTaskForback to summary
protected <T> RunnableFuture<T> newTaskFor(Callable<T> callable)

Decorate the given Callable and its return value, as a RunnableFuture, such that the returned RunnableFuture completes with the returned result from the Callable at the end of executing its RunnableFuture#run() method.

The returned RunnableFuture is the task that will actually be run by a thread in this executor.

This method can be overridden by sub-classes to hook into the life cycle of the given task.

Parameters
<T>
The type of the result value.
callable:Callable<T>

The task to be decorated.

Returns:RunnableFuture<T>

The decorated Runnable that is now also a Future.

safeExecuteback to summary
pack-priv static void safeExecute(Runnable task)

Try to execute the given Runnable and just log if it throws a Throwable.

submitback to summary
public final Future<Void> submit(Runnable task)

Implements io.netty5.util.concurrent.EventExecutor.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 final <T> Future<T> submit(Runnable task, T result)

Implements io.netty5.util.concurrent.EventExecutor.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 final <T> Future<T> submit(Callable<T> task)

Implements io.netty5.util.concurrent.EventExecutor.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