Class AbstractEventExecutor
java.lang.Object
java.util.concurrent.AbstractExecutorService
io.netty.util.concurrent.AbstractEventExecutor
- All Implemented Interfaces:
EventExecutor, EventExecutorGroup, ThreadAwareExecutor, java.lang.Iterable<EventExecutor>, java.util.concurrent.Executor, java.util.concurrent.ExecutorService, java.util.concurrent.ScheduledExecutorService
- Direct Known Subclasses:
AbstractEventLoop, AbstractScheduledEventExecutor, ImmediateEventExecutor, NonStickyEventExecutorGroup.NonStickyOrderedEventExecutor
public abstract class AbstractEventExecutor
extends java.util.concurrent.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 longprivate static final InternalLoggerprivate final EventExecutorGroupprivate final java.util.Collection<EventExecutor> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedprotected -
Method Summary
Modifier and TypeMethodDescriptionjava.util.Iterator<EventExecutor> iterator()voidlazyExecute(java.lang.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.protected final <T> java.util.concurrent.RunnableFuture<T> newTaskFor(java.lang.Runnable runnable, T value) protected final <T> java.util.concurrent.RunnableFuture<T> newTaskFor(java.util.concurrent.Callable<T> callable) next()Returns one of theEventExecutors managed by thisEventExecutorGroup.parent()Return theEventExecutorGroupwhich is the parent of thisEventExecutor,protected static voidrunTask(java.lang.Runnable task) protected static voidsafeExecute(java.lang.Runnable task) Try to execute the givenRunnableand just log if it throws aThrowable.schedule(java.lang.Runnable command, long delay, java.util.concurrent.TimeUnit unit) <V> ScheduledFuture<V> schedule(java.util.concurrent.Callable<V> callable, long delay, java.util.concurrent.TimeUnit unit) scheduleAtFixedRate(java.lang.Runnable command, long initialDelay, long period, java.util.concurrent.TimeUnit unit) scheduleWithFixedDelay(java.lang.Runnable command, long initialDelay, long delay, java.util.concurrent.TimeUnit unit) abstract voidshutdown()Deprecated.Future<?> Shortcut method forEventExecutorGroup.shutdownGracefully(long, long, TimeUnit)with sensible default values.java.util.List<java.lang.Runnable> Deprecated.Future<?> submit(java.lang.Runnable task) <T> Future<T> submit(java.lang.Runnable task, T result) <T> Future<T> submit(java.util.concurrent.Callable<T> task) Methods inherited from class java.util.concurrent.AbstractExecutorService
invokeAll, invokeAll, invokeAny, invokeAnyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface EventExecutor
inEventLoop, inEventLoop, isExecutorThread, isSuspended, newFailedFuture, newProgressivePromise, newPromise, newSucceededFuture, trySuspendMethods inherited from interface EventExecutorGroup
isShuttingDown, shutdownGracefully, terminationFuture, tickerMethods inherited from interface java.util.concurrent.Executor
executeMethods inherited from interface java.util.concurrent.ExecutorService
awaitTermination, invokeAll, invokeAll, invokeAny, invokeAny, isShutdown, isTerminatedMethods 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:EventExecutorReturn theEventExecutorGroupwhich is the parent of thisEventExecutor,- Specified by:
parentin interfaceEventExecutor
-
next
Description copied from interface:EventExecutorGroupReturns one of theEventExecutors managed by thisEventExecutorGroup.- Specified by:
nextin interfaceEventExecutorGroup
-
iterator
- Specified by:
iteratorin interfaceEventExecutorGroup- Specified by:
iteratorin interfacejava.lang.Iterable<EventExecutor>
-
shutdownGracefully
Description copied from interface:EventExecutorGroupShortcut method forEventExecutorGroup.shutdownGracefully(long, long, TimeUnit)with sensible default values.- Specified by:
shutdownGracefullyin interfaceEventExecutorGroup- Returns:
- the
EventExecutorGroup.terminationFuture()
-
shutdown
@Deprecated public abstract void shutdown()Deprecated.- Specified by:
shutdownin interfaceEventExecutorGroup- Specified by:
shutdownin interfacejava.util.concurrent.ExecutorService
-
shutdownNow
@Deprecated public java.util.List<java.lang.Runnable> shutdownNow()Deprecated.- Specified by:
shutdownNowin interfaceEventExecutorGroup- Specified by:
shutdownNowin interfacejava.util.concurrent.ExecutorService
-
submit
- Specified by:
submitin interfaceEventExecutorGroup- Specified by:
submitin interfacejava.util.concurrent.ExecutorService- Overrides:
submitin classjava.util.concurrent.AbstractExecutorService
-
submit
- Specified by:
submitin interfaceEventExecutorGroup- Specified by:
submitin interfacejava.util.concurrent.ExecutorService- Overrides:
submitin classjava.util.concurrent.AbstractExecutorService
-
submit
- Specified by:
submitin interfaceEventExecutorGroup- Specified by:
submitin interfacejava.util.concurrent.ExecutorService- Overrides:
submitin classjava.util.concurrent.AbstractExecutorService
-
newTaskFor
protected final <T> java.util.concurrent.RunnableFuture<T> newTaskFor(java.lang.Runnable runnable, T value) - Overrides:
newTaskForin classjava.util.concurrent.AbstractExecutorService
-
newTaskFor
protected final <T> java.util.concurrent.RunnableFuture<T> newTaskFor(java.util.concurrent.Callable<T> callable) - Overrides:
newTaskForin classjava.util.concurrent.AbstractExecutorService
-
schedule
public ScheduledFuture<?> schedule(java.lang.Runnable command, long delay, java.util.concurrent.TimeUnit unit) - Specified by:
schedulein interfaceEventExecutorGroup- Specified by:
schedulein interfacejava.util.concurrent.ScheduledExecutorService
-
schedule
public <V> ScheduledFuture<V> schedule(java.util.concurrent.Callable<V> callable, long delay, java.util.concurrent.TimeUnit unit) - Specified by:
schedulein interfaceEventExecutorGroup- Specified by:
schedulein interfacejava.util.concurrent.ScheduledExecutorService
-
scheduleAtFixedRate
public ScheduledFuture<?> scheduleAtFixedRate(java.lang.Runnable command, long initialDelay, long period, java.util.concurrent.TimeUnit unit) - Specified by:
scheduleAtFixedRatein interfaceEventExecutorGroup- Specified by:
scheduleAtFixedRatein interfacejava.util.concurrent.ScheduledExecutorService
-
scheduleWithFixedDelay
public ScheduledFuture<?> scheduleWithFixedDelay(java.lang.Runnable command, long initialDelay, long delay, java.util.concurrent.TimeUnit unit) - Specified by:
scheduleWithFixedDelayin interfaceEventExecutorGroup- Specified by:
scheduleWithFixedDelayin interfacejava.util.concurrent.ScheduledExecutorService
-
safeExecute
protected static void safeExecute(java.lang.Runnable task) Try to execute the givenRunnableand just log if it throws aThrowable. -
runTask
protected static void runTask(java.lang.Runnable task) -
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(Runnable)to re-create this behaviour