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, scheduleWithFixedDelay
iterator, newFailedFuture, newProgressivePromise, newPromise, newSucceededFuture, newTaskFor, newTaskFor, shutdownGracefully, shutdownNow, submit, submit, submit
invokeAll, invokeAll, invokeAny, invokeAny
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
newFailedFuture, newProgressivePromise, newPromise, newSucceededFuture
iterator, schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelay, shutdownGracefully, shutdownNow, submit, submit, submit
public void execute(java.lang.Runnable command)
execute
in interface java.util.concurrent.Executor
void runTasks()
long runScheduledTasks()
long nextScheduledTask()
protected void cancelScheduledTasks()
AbstractScheduledEventExecutor
AbstractEventExecutor.inEventLoop()
is true
.cancelScheduledTasks
in class AbstractScheduledEventExecutor
public Future<?> shutdownGracefully(long quietPeriod, long timeout, java.util.concurrent.TimeUnit unit)
EventExecutorGroup
EventExecutorGroup.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 EventExecutorGroup
quietPeriod
- 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 timeout
EventExecutorGroup.terminationFuture()
public Future<?> terminationFuture()
EventExecutorGroup
Future
which is notified when this executor has been terminated.terminationFuture
in interface EventExecutorGroup
@Deprecated public void shutdown()
shutdown
in interface EventExecutorGroup
shutdown
in interface java.util.concurrent.ExecutorService
shutdown
in class AbstractEventExecutor
public boolean isShuttingDown()
EventExecutorGroup
true
if and only if this executor was started to be
shut down gracefuclly or was shut down.isShuttingDown
in interface EventExecutorGroup
public boolean isShutdown()
isShutdown
in interface java.util.concurrent.ExecutorService
public boolean isTerminated()
isTerminated
in interface java.util.concurrent.ExecutorService
public boolean awaitTermination(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
awaitTermination
in interface java.util.concurrent.ExecutorService
java.lang.InterruptedException
public ChannelFuture register(Channel channel)
EventLoopGroup
Channel
with this EventLoop
. The returned ChannelFuture
will get notified once the registration was complete.register
in interface EventLoopGroup
public ChannelFuture register(Channel channel, ChannelPromise promise)
EventLoopGroup
Channel
with this EventLoop
. The passed ChannelFuture
will get notified once the registration was complete and also will get returned.register
in interface EventLoopGroup
public boolean inEventLoop()
EventExecutor
EventExecutor.inEventLoop(Thread)
with Thread.currentThread()
as argumentinEventLoop
in interface EventExecutor
inEventLoop
in class AbstractEventExecutor
public boolean inEventLoop(java.lang.Thread thread)
EventExecutor
true
if the given Thread
is executed in the event loop,
false
otherwise.inEventLoop
in interface EventExecutor
public EventLoop next()
EventExecutor
next
in interface EventLoopGroup
next
in interface EventExecutor
next
in interface EventExecutorGroup
next
in class AbstractEventExecutor
public EventLoopGroup parent()
EventExecutor
EventExecutorGroup
which is the parent of this EventExecutor
,parent
in interface EventLoop
parent
in interface EventExecutor