final class EmbeddedEventLoop extends AbstractScheduledEventExecutor implements EventLoop
| Modifier and Type | Field and Description |
|---|---|
private java.util.Queue<java.lang.Runnable> |
tasks |
| Constructor and Description |
|---|
EmbeddedEventLoop() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long timeout,
java.util.concurrent.TimeUnit unit) |
protected void |
cancelScheduledTasks()
Cancel all scheduled tasks.
|
void |
execute(java.lang.Runnable command) |
boolean |
inEventLoop()
Calls
EventExecutor.inEventLoop(Thread) with Thread.currentThread() as argument |
boolean |
inEventLoop(java.lang.Thread thread)
Return
true if the given Thread is executed in the event loop,
false otherwise. |
boolean |
isShutdown() |
boolean |
isShuttingDown()
Returns
true if and only if this executor was started to be
shut down gracefuclly or was shut down. |
boolean |
isTerminated() |
EventLoop |
next()
Returns a reference to itself.
|
(package private) long |
nextScheduledTask() |
EventLoopGroup |
parent()
Return the
EventExecutorGroup which is the parent of this EventExecutor, |
ChannelFuture |
register(Channel channel)
|
ChannelFuture |
register(Channel channel,
ChannelPromise promise)
|
(package private) long |
runScheduledTasks() |
(package private) void |
runTasks() |
void |
shutdown()
Deprecated.
|
Future<?> |
shutdownGracefully(long quietPeriod,
long timeout,
java.util.concurrent.TimeUnit unit)
Signals this executor that the caller wants the executor to be shut down.
|
Future<?> |
terminationFuture()
Returns the
Future which is notified when this executor has been terminated. |
hasScheduledTasks, nanoTime, nextScheduledTaskNano, pollScheduledTask, pollScheduledTask, schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelayiterator, newFailedFuture, newProgressivePromise, newPromise, newSucceededFuture, newTaskFor, newTaskFor, shutdownGracefully, shutdownNow, submit, submit, submitinvokeAll, invokeAll, invokeAny, invokeAnyclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitnewFailedFuture, newProgressivePromise, newPromise, newSucceededFutureiterator, schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelay, shutdownGracefully, shutdownNow, submit, submit, submitpublic void execute(java.lang.Runnable command)
execute in interface java.util.concurrent.Executorvoid runTasks()
long runScheduledTasks()
long nextScheduledTask()
protected void cancelScheduledTasks()
AbstractScheduledEventExecutorAbstractEventExecutor.inEventLoop() is true.cancelScheduledTasks in class AbstractScheduledEventExecutorpublic Future<?> shutdownGracefully(long quietPeriod, long timeout, java.util.concurrent.TimeUnit unit)
EventExecutorGroupEventExecutorGroup.isShuttingDown() starts to return true, and the executor prepares to shut itself down.
Unlike EventExecutorGroup.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.shutdownGracefully in interface EventExecutorGroupquietPeriod - the quiet period as described in the documentationtimeout - the maximum amount of time to wait until the executor is EventExecutorGroup.shutdown()
regardless if a task was submitted during the quiet periodunit - the unit of quietPeriod and timeoutEventExecutorGroup.terminationFuture()public Future<?> terminationFuture()
EventExecutorGroupFuture which is notified when this executor has been terminated.terminationFuture in interface EventExecutorGroup@Deprecated public void shutdown()
shutdown in interface EventExecutorGroupshutdown in interface java.util.concurrent.ExecutorServiceshutdown in class AbstractEventExecutorpublic boolean isShuttingDown()
EventExecutorGrouptrue if and only if this executor was started to be
shut down gracefuclly or was shut down.isShuttingDown in interface EventExecutorGrouppublic boolean isShutdown()
isShutdown in interface java.util.concurrent.ExecutorServicepublic boolean isTerminated()
isTerminated in interface java.util.concurrent.ExecutorServicepublic boolean awaitTermination(long timeout,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException
awaitTermination in interface java.util.concurrent.ExecutorServicejava.lang.InterruptedExceptionpublic ChannelFuture register(Channel channel)
EventLoopGroupChannel with this EventLoop. The returned ChannelFuture
will get notified once the registration was complete.register in interface EventLoopGrouppublic ChannelFuture register(Channel channel, ChannelPromise promise)
EventLoopGroupChannel with this EventLoop. The passed ChannelFuture
will get notified once the registration was complete and also will get returned.register in interface EventLoopGrouppublic boolean inEventLoop()
EventExecutorEventExecutor.inEventLoop(Thread) with Thread.currentThread() as argumentinEventLoop in interface EventExecutorinEventLoop in class AbstractEventExecutorpublic boolean inEventLoop(java.lang.Thread thread)
EventExecutortrue if the given Thread is executed in the event loop,
false otherwise.inEventLoop in interface EventExecutorpublic EventLoop next()
EventExecutornext in interface EventLoopGroupnext in interface EventExecutornext in interface EventExecutorGroupnext in class AbstractEventExecutorpublic EventLoopGroup parent()
EventExecutorEventExecutorGroup which is the parent of this EventExecutor,parent in interface EventLoopparent in interface EventExecutor