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:
AbstractScheduledEventExecutor
,ImmediateEventExecutor
public abstract class AbstractEventExecutor extends AbstractExecutorService implements EventExecutor
Abstract base class forEventExecutor
implementations.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
AbstractEventExecutor.LazyRunnable
Deprecated.overrideSingleThreadEventExecutor.wakesUpForTask(java.lang.Runnable)
to re-create this behaviour
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractEventExecutor()
protected
AbstractEventExecutor(EventExecutorGroup parent)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Iterator<EventExecutor>
iterator()
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.protected <T> RunnableFuture<T>
newTaskFor(Runnable runnable, T value)
protected <T> RunnableFuture<T>
newTaskFor(Callable<T> callable)
EventExecutor
next()
Returns one of theEventExecutor
s managed by thisEventExecutorGroup
.EventExecutorGroup
parent()
Return theEventExecutorGroup
which is the parent of thisEventExecutor
,protected static void
runTask(Runnable task)
protected static void
safeExecute(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 void
shutdown()
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, inEventLoop, newFailedFuture, newProgressivePromise, newPromise, newSucceededFuture
-
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:EventExecutor
Return theEventExecutorGroup
which is the parent of thisEventExecutor
,- Specified by:
parent
in interfaceEventExecutor
-
next
public EventExecutor next()
Description copied from interface:EventExecutorGroup
Returns one of theEventExecutor
s managed by thisEventExecutorGroup
.- Specified by:
next
in interfaceEventExecutorGroup
-
iterator
public Iterator<EventExecutor> iterator()
- Specified by:
iterator
in interfaceEventExecutorGroup
- Specified by:
iterator
in interfaceIterable<EventExecutor>
-
shutdownGracefully
public Future<?> 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 public abstract void shutdown()
Deprecated.- Specified by:
shutdown
in interfaceEventExecutorGroup
- Specified by:
shutdown
in interfaceExecutorService
-
shutdownNow
@Deprecated public List<Runnable> shutdownNow()
Deprecated.- Specified by:
shutdownNow
in interfaceEventExecutorGroup
- Specified by:
shutdownNow
in interfaceExecutorService
-
submit
public Future<?> submit(Runnable task)
- Specified by:
submit
in interfaceEventExecutorGroup
- Specified by:
submit
in interfaceExecutorService
- Overrides:
submit
in classAbstractExecutorService
-
submit
public <T> Future<T> submit(Runnable task, T result)
- Specified by:
submit
in interfaceEventExecutorGroup
- Specified by:
submit
in interfaceExecutorService
- Overrides:
submit
in classAbstractExecutorService
-
submit
public <T> Future<T> submit(Callable<T> task)
- Specified by:
submit
in interfaceEventExecutorGroup
- Specified by:
submit
in interfaceExecutorService
- Overrides:
submit
in classAbstractExecutorService
-
newTaskFor
protected final <T> RunnableFuture<T> newTaskFor(Runnable runnable, T value)
- Overrides:
newTaskFor
in classAbstractExecutorService
-
newTaskFor
protected final <T> RunnableFuture<T> newTaskFor(Callable<T> callable)
- Overrides:
newTaskFor
in classAbstractExecutorService
-
schedule
public ScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit)
- Specified by:
schedule
in interfaceEventExecutorGroup
- Specified by:
schedule
in interfaceScheduledExecutorService
-
schedule
public <V> ScheduledFuture<V> schedule(Callable<V> callable, long delay, TimeUnit unit)
- 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
protected static void safeExecute(Runnable task)
-
runTask
protected static void runTask(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.The default implementation just delegates to
Executor.execute(Runnable)
.
-
-