Package io.netty.util.concurrent
Class AbstractEventExecutor
java.lang.Object
java.util.concurrent.AbstractExecutorService
io.netty.util.concurrent.AbstractEventExecutor
- All Implemented Interfaces:
EventExecutor
,EventExecutorGroup
,AutoCloseable
,Iterable<EventExecutor>
,Executor
,ExecutorService
,ScheduledExecutorService
- Direct Known Subclasses:
AbstractEventLoop
,AbstractScheduledEventExecutor
,ImmediateEventExecutor
,NonStickyEventExecutorGroup.NonStickyOrderedEventExecutor
public abstract class AbstractEventExecutor
extends AbstractExecutorService
implements EventExecutor
Abstract base class for
EventExecutor
implementations.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final long
(package private) static final long
private static final InternalLogger
private final EventExecutorGroup
private final Collection
<EventExecutor> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
protected
-
Method Summary
Modifier and TypeMethodDescriptionboolean
CallsEventExecutor.inEventLoop(Thread)
withThread.currentThread()
as argumentiterator()
void
lazyExecute
(Runnable task) LikeExecutor.execute(Runnable)
but does not guarantee the task will be run until either a non-lazy task is executed or the executor is shut down.<V> Future
<V> newFailedFuture
(Throwable cause) Create a newFuture
which is marked as failed already.<V> ProgressivePromise
<V> Create a newProgressivePromise
.<V> Promise
<V> Return a newPromise
.<V> Future
<V> newSucceededFuture
(V result) Create a newFuture
which is marked as succeeded already.protected final <T> RunnableFuture
<T> newTaskFor
(Runnable runnable, T value) protected final <T> RunnableFuture
<T> newTaskFor
(Callable<T> callable) next()
Returns a reference to itself.parent()
Return theEventExecutorGroup
which is the parent of thisEventExecutor
,protected static void
protected static void
safeExecute
(Runnable task) <V> ScheduledFuture
<V> scheduleAtFixedRate
(Runnable command, long initialDelay, long period, TimeUnit unit) scheduleWithFixedDelay
(Runnable command, long initialDelay, long delay, TimeUnit unit) abstract void
shutdown()
Deprecated.Future
<?> Shortcut method forEventExecutorGroup.shutdownGracefully(long, long, TimeUnit)
with sensible default values.Deprecated.Future
<?> <T> Future
<T> <T> Future
<T> Methods inherited from class java.util.concurrent.AbstractExecutorService
invokeAll, invokeAll, invokeAny, invokeAny
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.netty.util.concurrent.EventExecutor
inEventLoop
Methods inherited from interface io.netty.util.concurrent.EventExecutorGroup
isShuttingDown, shutdownGracefully, terminationFuture
Methods inherited from interface java.util.concurrent.ExecutorService
awaitTermination, close, invokeAll, invokeAll, invokeAny, invokeAny, isShutdown, isTerminated
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
logger
-
DEFAULT_SHUTDOWN_QUIET_PERIOD
static final long DEFAULT_SHUTDOWN_QUIET_PERIOD- See Also:
-
DEFAULT_SHUTDOWN_TIMEOUT
static final long DEFAULT_SHUTDOWN_TIMEOUT- See Also:
-
parent
-
selfCollection
-
-
Constructor Details
-
AbstractEventExecutor
protected AbstractEventExecutor() -
AbstractEventExecutor
-
-
Method Details
-
parent
Description copied from interface:EventExecutor
Return theEventExecutorGroup
which is the parent of thisEventExecutor
,- Specified by:
parent
in interfaceEventExecutor
-
next
Description copied from interface:EventExecutor
Returns a reference to itself.- Specified by:
next
in interfaceEventExecutor
- Specified by:
next
in interfaceEventExecutorGroup
-
inEventLoop
public boolean inEventLoop()Description copied from interface:EventExecutor
CallsEventExecutor.inEventLoop(Thread)
withThread.currentThread()
as argument- Specified by:
inEventLoop
in interfaceEventExecutor
-
iterator
- Specified by:
iterator
in interfaceEventExecutorGroup
- Specified by:
iterator
in interfaceIterable<EventExecutor>
-
shutdownGracefully
Description copied from interface:EventExecutorGroup
Shortcut method forEventExecutorGroup.shutdownGracefully(long, long, TimeUnit)
with sensible default values.- Specified by:
shutdownGracefully
in interfaceEventExecutorGroup
- Returns:
- the
EventExecutorGroup.terminationFuture()
-
shutdown
Deprecated.- Specified by:
shutdown
in interfaceEventExecutorGroup
- Specified by:
shutdown
in interfaceExecutorService
-
shutdownNow
Deprecated.- Specified by:
shutdownNow
in interfaceEventExecutorGroup
- Specified by:
shutdownNow
in interfaceExecutorService
-
newPromise
Description copied from interface:EventExecutor
Return a newPromise
.- Specified by:
newPromise
in interfaceEventExecutor
-
newProgressivePromise
Description copied from interface:EventExecutor
Create a newProgressivePromise
.- Specified by:
newProgressivePromise
in interfaceEventExecutor
-
newSucceededFuture
Description copied from interface:EventExecutor
Create a newFuture
which is marked as succeeded already. SoFuture.isSuccess()
will returntrue
. AllFutureListener
added to it will be notified directly. Also every call of blocking methods will just return without blocking.- Specified by:
newSucceededFuture
in interfaceEventExecutor
-
newFailedFuture
Description copied from interface:EventExecutor
Create a newFuture
which is marked as failed already. SoFuture.isSuccess()
will returnfalse
. AllFutureListener
added to it will be notified directly. Also every call of blocking methods will just return without blocking.- Specified by:
newFailedFuture
in interfaceEventExecutor
-
submit
- Specified by:
submit
in interfaceEventExecutorGroup
- Specified by:
submit
in interfaceExecutorService
- Overrides:
submit
in classAbstractExecutorService
-
submit
- Specified by:
submit
in interfaceEventExecutorGroup
- Specified by:
submit
in interfaceExecutorService
- Overrides:
submit
in classAbstractExecutorService
-
submit
- Specified by:
submit
in interfaceEventExecutorGroup
- Specified by:
submit
in interfaceExecutorService
- Overrides:
submit
in classAbstractExecutorService
-
newTaskFor
- Overrides:
newTaskFor
in classAbstractExecutorService
-
newTaskFor
- Overrides:
newTaskFor
in classAbstractExecutorService
-
schedule
- Specified by:
schedule
in interfaceEventExecutorGroup
- Specified by:
schedule
in interfaceScheduledExecutorService
-
schedule
- Specified by:
schedule
in interfaceEventExecutorGroup
- Specified by:
schedule
in interfaceScheduledExecutorService
-
scheduleAtFixedRate
public ScheduledFuture<?> scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit) - Specified by:
scheduleAtFixedRate
in interfaceEventExecutorGroup
- Specified by:
scheduleAtFixedRate
in interfaceScheduledExecutorService
-
scheduleWithFixedDelay
public ScheduledFuture<?> scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit) - Specified by:
scheduleWithFixedDelay
in interfaceEventExecutorGroup
- Specified by:
scheduleWithFixedDelay
in interfaceScheduledExecutorService
-
safeExecute
-
runTask
-
lazyExecute
LikeExecutor.execute(Runnable)
but does not guarantee the task will be run until either a non-lazy task is executed or the executor is shut down.The default implementation just delegates to
Executor.execute(Runnable)
.
-
SingleThreadEventExecutor.wakesUpForTask(java.lang.Runnable)
to re-create this behaviour