Package io.netty.util.concurrent
Class AbstractEventExecutor
- java.lang.Object
-
- java.util.concurrent.AbstractExecutorService
-
- io.netty.util.concurrent.AbstractEventExecutor
-
- All Implemented Interfaces:
EventExecutor,EventExecutorGroup,Iterable<EventExecutor>,Executor,ExecutorService,ScheduledExecutorService
- Direct Known Subclasses:
AbstractEventLoop,AbstractScheduledEventExecutor,ImmediateEventExecutor
public abstract class AbstractEventExecutor extends AbstractExecutorService implements EventExecutor
Abstract base class forEventExecutorimplementations.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceAbstractEventExecutor.LazyRunnableMarker interface forRunnableto indicate that it should be queued for execution but does not need to run immediately.
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractEventExecutor()protectedAbstractEventExecutor(EventExecutorGroup parent)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleaninEventLoop()CallsEventExecutor.inEventLoop(Thread)withThread.currentThread()as argumentIterator<EventExecutor>iterator()voidlazyExecute(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 newFuturewhich is marked as failed already.<V> ProgressivePromise<V>newProgressivePromise()Create a newProgressivePromise.<V> Promise<V>newPromise()Return a newPromise.<V> Future<V>newSucceededFuture(V result)Create a newFuturewhich is marked as succeeded already.protected <T> RunnableFuture<T>newTaskFor(Runnable runnable, T value)protected <T> RunnableFuture<T>newTaskFor(Callable<T> callable)EventExecutornext()Returns a reference to itself.EventExecutorGroupparent()Return theEventExecutorGroupwhich is the parent of thisEventExecutor,protected static voidsafeExecute(Runnable task)ScheduledFuture<?>schedule(Runnable command, long delay, TimeUnit unit)<V> ScheduledFuture<V>schedule(Callable<V> callable, long delay, TimeUnit unit)ScheduledFuture<?>scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit)ScheduledFuture<?>scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit)abstract voidshutdown()Deprecated.Future<?>shutdownGracefully()Shortcut method forEventExecutorGroup.shutdownGracefully(long, long, TimeUnit)with sensible default values.List<Runnable>shutdownNow()Deprecated.Future<?>submit(Runnable task)<T> Future<T>submit(Runnable task, T result)<T> Future<T>submit(Callable<T> task)-
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, invokeAll, invokeAll, invokeAny, invokeAny, isShutdown, isTerminated
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
AbstractEventExecutor
protected AbstractEventExecutor()
-
AbstractEventExecutor
protected AbstractEventExecutor(EventExecutorGroup parent)
-
-
Method Detail
-
parent
public EventExecutorGroup parent()
Description copied from interface:EventExecutorReturn theEventExecutorGroupwhich is the parent of thisEventExecutor,- Specified by:
parentin interfaceEventExecutor
-
next
public EventExecutor next()
Description copied from interface:EventExecutorReturns a reference to itself.- Specified by:
nextin interfaceEventExecutor- Specified by:
nextin interfaceEventExecutorGroup
-
inEventLoop
public boolean inEventLoop()
Description copied from interface:EventExecutorCallsEventExecutor.inEventLoop(Thread)withThread.currentThread()as argument- Specified by:
inEventLoopin interfaceEventExecutor
-
iterator
public Iterator<EventExecutor> iterator()
- Specified by:
iteratorin interfaceEventExecutorGroup- Specified by:
iteratorin interfaceIterable<EventExecutor>
-
shutdownGracefully
public Future<?> 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 interfaceExecutorService
-
shutdownNow
@Deprecated public List<Runnable> shutdownNow()
Deprecated.- Specified by:
shutdownNowin interfaceEventExecutorGroup- Specified by:
shutdownNowin interfaceExecutorService
-
newPromise
public <V> Promise<V> newPromise()
Description copied from interface:EventExecutorReturn a newPromise.- Specified by:
newPromisein interfaceEventExecutor
-
newProgressivePromise
public <V> ProgressivePromise<V> newProgressivePromise()
Description copied from interface:EventExecutorCreate a newProgressivePromise.- Specified by:
newProgressivePromisein interfaceEventExecutor
-
newSucceededFuture
public <V> Future<V> newSucceededFuture(V result)
Description copied from interface:EventExecutorCreate a newFuturewhich is marked as succeeded already. SoFuture.isSuccess()will returntrue. AllFutureListeneradded to it will be notified directly. Also every call of blocking methods will just return without blocking.- Specified by:
newSucceededFuturein interfaceEventExecutor
-
newFailedFuture
public <V> Future<V> newFailedFuture(Throwable cause)
Description copied from interface:EventExecutorCreate a newFuturewhich is marked as failed already. SoFuture.isSuccess()will returnfalse. AllFutureListeneradded to it will be notified directly. Also every call of blocking methods will just return without blocking.- Specified by:
newFailedFuturein interfaceEventExecutor
-
submit
public Future<?> submit(Runnable task)
- Specified by:
submitin interfaceEventExecutorGroup- Specified by:
submitin interfaceExecutorService- Overrides:
submitin classAbstractExecutorService
-
submit
public <T> Future<T> submit(Runnable task, T result)
- Specified by:
submitin interfaceEventExecutorGroup- Specified by:
submitin interfaceExecutorService- Overrides:
submitin classAbstractExecutorService
-
submit
public <T> Future<T> submit(Callable<T> task)
- Specified by:
submitin interfaceEventExecutorGroup- Specified by:
submitin interfaceExecutorService- Overrides:
submitin classAbstractExecutorService
-
newTaskFor
protected final <T> RunnableFuture<T> newTaskFor(Runnable runnable, T value)
- Overrides:
newTaskForin classAbstractExecutorService
-
newTaskFor
protected final <T> RunnableFuture<T> newTaskFor(Callable<T> callable)
- Overrides:
newTaskForin classAbstractExecutorService
-
schedule
public ScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit)
- Specified by:
schedulein interfaceEventExecutorGroup- Specified by:
schedulein interfaceScheduledExecutorService
-
schedule
public <V> ScheduledFuture<V> schedule(Callable<V> callable, long delay, TimeUnit unit)
- Specified by:
schedulein interfaceEventExecutorGroup- Specified by:
schedulein interfaceScheduledExecutorService
-
scheduleAtFixedRate
public ScheduledFuture<?> scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit)
- Specified by:
scheduleAtFixedRatein interfaceEventExecutorGroup- Specified by:
scheduleAtFixedRatein interfaceScheduledExecutorService
-
scheduleWithFixedDelay
public ScheduledFuture<?> scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit)
- Specified by:
scheduleWithFixedDelayin interfaceEventExecutorGroup- Specified by:
scheduleWithFixedDelayin interfaceScheduledExecutorService
-
safeExecute
protected static void safeExecute(Runnable task)
-
lazyExecute
@UnstableApi public 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. This is equivalent to submitting aAbstractEventExecutor.LazyRunnabletoExecutor.execute(Runnable)but for an arbitraryRunnable. The default implementation just delegates toExecutor.execute(Runnable).
-
-