Top Description Inners Fields Constructors Methods
io.netty.util.concurrent

public final Class ImmediateEventExecutor

extends AbstractEventExecutor
Class Inheritance
Imports
io.netty.util.internal.ObjectUtil, io.netty.util.internal.logging.InternalLogger, .InternalLoggerFactory, java.util.ArrayDeque, .Queue, java.util.concurrent.TimeUnit

Executes Runnable objects in the caller's thread. If the execute(Runnable) is reentrant it will be queued until the original Runnable finishes execution.

All Throwable objects thrown from execute(Runnable) will be swallowed and logged. This is to ensure that all queued Runnable objects have the chance to be run.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
pack-priv static class

Field Summary

Modifier and TypeField and Description
private static final FastThreadLocal<Queue<Runnable>>
DELAYED_RUNNABLES

A Runnable will be queued if we are executing a Runnable.

public static final ImmediateEventExecutor
private static final InternalLogger
private static final FastThreadLocal<Boolean>
RUNNING

Set to true if we are executing a runnable.

private final Future<?>
Inherited from io.netty.util.concurrent.AbstractEventExecutor:
DEFAULT_SHUTDOWN_QUIET_PERIODDEFAULT_SHUTDOWN_TIMEOUT

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public boolean
awaitTermination(long
the maximum time to wait
timeout
,
TimeUnit
the time unit of the timeout argument
unit
)

Implements java.util.concurrent.ExecutorService.awaitTermination.

Blocks until all tasks have completed execution after a shutdown request, or the timeout occurs, or the current thread is interrupted, whichever happens first.
public void
execute(Runnable
the runnable task
command
)

Implements java.util.concurrent.Executor.execute.

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

Implements io.netty.util.concurrent.EventExecutor.inEventLoop.

Return true if the given Thread is executed in the event loop, false otherwise.
public boolean
isShutdown()

Implements java.util.concurrent.ExecutorService.isShutdown.

Returns true if this executor has been shut down.
public boolean
public boolean
isTerminated()

Implements java.util.concurrent.ExecutorService.isTerminated.

Returns true if all tasks have completed following shut down.
public <V> ProgressivePromise<V>
public <V> Promise<V>
public void
shutdown()

Implements abstract io.netty.util.concurrent.AbstractEventExecutor.shutdown.

Implements io.netty.util.concurrent.EventExecutorGroup.shutdown, java.util.concurrent.ExecutorService.shutdown.

Deprecated
Initiates an orderly shutdown in which previously submitted tasks are executed, but no new tasks will be accepted.
public Future<?>
shutdownGracefully(long
the quiet period as described in the documentation
quietPeriod
,
long
the maximum amount of time to wait until the executor is shutdown() regardless if a task was submitted during the quiet period
timeout
,
TimeUnit
the unit of quietPeriod and timeout
unit
)

Implements io.netty.util.concurrent.EventExecutorGroup.shutdownGracefully.

Signals this executor that the caller wants the executor to be shut down.
public Future<?>
terminationFuture()

Implements io.netty.util.concurrent.EventExecutorGroup.terminationFuture.

Returns the Future which is notified when all EventExecutors managed by this EventExecutorGroup have been terminated.
Inherited from io.netty.util.concurrent.AbstractEventExecutor:
iteratorlazyExecutenewFailedFuturenewSucceededFuturenewTaskFornewTaskFornextparentrunTasksafeExecutescheduleschedulescheduleAtFixedRatescheduleWithFixedDelayshutdownGracefullyshutdownNowsubmitsubmitsubmit

Field Detail

DELAYED_RUNNABLESback to summary
private static final FastThreadLocal<Queue<Runnable>> DELAYED_RUNNABLES

A Runnable will be queued if we are executing a Runnable. This is to prevent a StackOverflowError.

INSTANCEback to summary
public static final ImmediateEventExecutor INSTANCE
loggerback to summary
private static final InternalLogger logger

Hides io.netty.util.concurrent.AbstractEventExecutor.logger.

RUNNINGback to summary
private static final FastThreadLocal<Boolean> RUNNING

Set to true if we are executing a runnable.

terminationFutureback to summary
private final Future<?> terminationFuture

Constructor Detail

ImmediateEventExecutorback to summary
private ImmediateEventExecutor()

Method Detail

awaitTerminationback to summary
public boolean awaitTermination(long timeout, TimeUnit unit)

Implements java.util.concurrent.ExecutorService.awaitTermination.

Doc from java.util.concurrent.ExecutorService.awaitTermination.

Blocks until all tasks have completed execution after a shutdown request, or the timeout occurs, or the current thread is interrupted, whichever happens first.

Parameters
timeout:long

the maximum time to wait

unit:TimeUnit

the time unit of the timeout argument

Returns:boolean

true if this executor terminated and false if the timeout elapsed before termination

Annotations
@Override
executeback to summary
public void execute(Runnable command)

Implements java.util.concurrent.Executor.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
command:Runnable

the runnable task

Annotations
@Override
inEventLoopback to summary
public boolean inEventLoop()

Overrides io.netty.util.concurrent.AbstractEventExecutor.inEventLoop.

Implements io.netty.util.concurrent.EventExecutor.inEventLoop.

Doc from io.netty.util.concurrent.EventExecutor.inEventLoop.

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

Annotations
@Override
inEventLoopback to summary
public boolean inEventLoop(Thread thread)

Implements io.netty.util.concurrent.EventExecutor.inEventLoop.

Doc from io.netty.util.concurrent.EventExecutor.inEventLoop.

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

Annotations
@Override
isShutdownback to summary
public boolean isShutdown()

Implements java.util.concurrent.ExecutorService.isShutdown.

Doc from java.util.concurrent.ExecutorService.isShutdown.

Returns true if this executor has been shut down.

Returns:boolean

true if this executor has been shut down

Annotations
@Override
isShuttingDownback to summary
public boolean isShuttingDown()

Implements io.netty.util.concurrent.EventExecutorGroup.isShuttingDown.

Doc from io.netty.util.concurrent.EventExecutorGroup.isShuttingDown.

Returns true if and only if all EventExecutors managed by this EventExecutorGroup are being shut down gracefully or was shut down.

Annotations
@Override
isTerminatedback to summary
public boolean isTerminated()

Implements java.util.concurrent.ExecutorService.isTerminated.

Doc from java.util.concurrent.ExecutorService.isTerminated.

Returns true if all tasks have completed following shut down. Note that isTerminated is never true unless either shutdown or shutdownNow was called first.

Returns:boolean

true if all tasks have completed following shut down

Annotations
@Override
newProgressivePromiseback to summary
public <V> ProgressivePromise<V> newProgressivePromise()

Overrides io.netty.util.concurrent.AbstractEventExecutor.newProgressivePromise.

Implements io.netty.util.concurrent.EventExecutor.newProgressivePromise.

Doc from io.netty.util.concurrent.EventExecutor.newProgressivePromise.

Create a new ProgressivePromise.

Annotations
@Override
newPromiseback to summary
public <V> Promise<V> newPromise()

Overrides io.netty.util.concurrent.AbstractEventExecutor.newPromise.

Implements io.netty.util.concurrent.EventExecutor.newPromise.

Doc from io.netty.util.concurrent.EventExecutor.newPromise.

Return a new Promise.

Annotations
@Override
shutdownback to summary
public void shutdown()

Implements abstract io.netty.util.concurrent.AbstractEventExecutor.shutdown.

Implements io.netty.util.concurrent.EventExecutorGroup.shutdown, java.util.concurrent.ExecutorService.shutdown.

Doc from java.util.concurrent.ExecutorService.shutdown.

Deprecated

Initiates an orderly shutdown in which previously submitted tasks are executed, but no new tasks will be accepted. Invocation has no additional effect if already shut down.

This method does not wait for previously submitted tasks to complete execution. Use awaitTermination to do that.

Annotations
@Override
@Deprecated
shutdownGracefullyback to summary
public Future<?> shutdownGracefully(long quietPeriod, long timeout, TimeUnit unit)

Implements io.netty.util.concurrent.EventExecutorGroup.shutdownGracefully.

Doc from io.netty.util.concurrent.EventExecutorGroup.shutdownGracefully.

Signals this executor that the caller wants the executor to be shut down. Once this method is called, isShuttingDown() starts to return true, and the executor prepares to shut itself down. Unlike shutdown(), graceful shutdown ensures that no tasks are submitted for 'the quiet period' (usually a couple seconds) before it shuts itself down. If a task is submitted during the quiet period, it is guaranteed to be accepted and the quiet period will start over.

Parameters
quietPeriod:long

the quiet period as described in the documentation

timeout:long

the maximum amount of time to wait until the executor is shutdown() regardless if a task was submitted during the quiet period

unit:TimeUnit

the unit of quietPeriod and timeout

Returns:Future<?>

the terminationFuture()

Annotations
@Override
terminationFutureback to summary
public Future<?> terminationFuture()

Implements io.netty.util.concurrent.EventExecutorGroup.terminationFuture.

Doc from io.netty.util.concurrent.EventExecutorGroup.terminationFuture.

Returns the Future which is notified when all EventExecutors managed by this EventExecutorGroup have been terminated.

Annotations
@Override
io.netty.util.concurrent back to summary

pack-priv Class ImmediateEventExecutor.ImmediateProgressivePromise<V>

extends DefaultProgressivePromise<V>
Class Inheritance

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
protected void
Inherited from io.netty.util.concurrent.DefaultProgressivePromise:
addListeneraddListenersawaitawaitUninterruptiblyremoveListenerremoveListenerssetFailuresetProgresssetSuccesssyncsyncUninterruptiblytryProgress

Constructor Detail

ImmediateProgressivePromiseback to summary
pack-priv ImmediateProgressivePromise(EventExecutor executor)

Method Detail

checkDeadLockback to summary
protected void checkDeadLock()

Overrides io.netty.util.concurrent.DefaultPromise.checkDeadLock.

Annotations
@Override
io.netty.util.concurrent back to summary

pack-priv Class ImmediateEventExecutor.ImmediatePromise<V>

extends DefaultPromise<V>
Class Inheritance

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
protected void
Inherited from io.netty.util.concurrent.DefaultPromise:
addListeneraddListenersawaitawaitawaitawaitUninterruptiblyawaitUninterruptiblyawaitUninterruptiblycancelcauseexecutorgetgetgetNowisCancellableisCancelledisDoneisSuccessnotifyListenernotifyProgressiveListenersremoveListenerremoveListenerssetFailuresetSuccesssetUncancellablesyncsyncUninterruptiblytoStringtoStringBuildertryFailuretrySuccess

Constructor Detail

ImmediatePromiseback to summary
pack-priv ImmediatePromise(EventExecutor executor)

Method Detail

checkDeadLockback to summary
protected void checkDeadLock()

Overrides io.netty.util.concurrent.DefaultPromise.checkDeadLock.

Annotations
@Override