Package io.netty.util.concurrent
Class NonStickyEventExecutorGroup.NonStickyOrderedEventExecutor
- java.lang.Object
-
- java.util.concurrent.AbstractExecutorService
-
- io.netty.util.concurrent.AbstractEventExecutor
-
- io.netty.util.concurrent.NonStickyEventExecutorGroup.NonStickyOrderedEventExecutor
-
- All Implemented Interfaces:
EventExecutor,EventExecutorGroup,OrderedEventExecutor,java.lang.Iterable<EventExecutor>,java.lang.Runnable,java.util.concurrent.Executor,java.util.concurrent.ExecutorService,java.util.concurrent.ScheduledExecutorService
- Enclosing class:
- NonStickyEventExecutorGroup
private static final class NonStickyEventExecutorGroup.NonStickyOrderedEventExecutor extends AbstractEventExecutor implements java.lang.Runnable, OrderedEventExecutor
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class io.netty.util.concurrent.AbstractEventExecutor
AbstractEventExecutor.LazyRunnable
-
-
Field Summary
Fields Modifier and Type Field Description private EventExecutorexecutorprivate intmaxTaskExecutePerRunprivate static intNONEprivate static intRUNNINGprivate java.util.concurrent.atomic.AtomicIntegerstateprivate static intSUBMITTEDprivate java.util.Queue<java.lang.Runnable>tasks-
Fields inherited from class io.netty.util.concurrent.AbstractEventExecutor
DEFAULT_SHUTDOWN_QUIET_PERIOD, DEFAULT_SHUTDOWN_TIMEOUT
-
-
Constructor Summary
Constructors Constructor Description NonStickyOrderedEventExecutor(EventExecutor executor, int maxTaskExecutePerRun)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanawaitTermination(long timeout, java.util.concurrent.TimeUnit unit)voidexecute(java.lang.Runnable command)booleaninEventLoop()CallsEventExecutor.inEventLoop(Thread)withThread.currentThread()as argumentbooleaninEventLoop(java.lang.Thread thread)Returntrueif the givenThreadis executed in the event loop,falseotherwise.booleanisShutdown()booleanisShuttingDown()Returnstrueif and only if allEventExecutors managed by thisEventExecutorGroupare being shut down gracefully or was shut down.booleanisTerminated()voidrun()voidshutdown()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 theFuturewhich is notified when allEventExecutors managed by thisEventExecutorGrouphave been terminated.-
Methods inherited from class io.netty.util.concurrent.AbstractEventExecutor
iterator, lazyExecute, newFailedFuture, newProgressivePromise, newPromise, newSucceededFuture, newTaskFor, newTaskFor, next, parent, safeExecute, schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelay, shutdownGracefully, shutdownNow, submit, submit, submit
-
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
newFailedFuture, newProgressivePromise, newPromise, newSucceededFuture, next, parent
-
Methods inherited from interface io.netty.util.concurrent.EventExecutorGroup
iterator, schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelay, shutdownGracefully, shutdownNow, submit, submit, submit
-
-
-
-
Field Detail
-
executor
private final EventExecutor executor
-
tasks
private final java.util.Queue<java.lang.Runnable> tasks
-
NONE
private static final int NONE
- See Also:
- Constant Field Values
-
SUBMITTED
private static final int SUBMITTED
- See Also:
- Constant Field Values
-
RUNNING
private static final int RUNNING
- See Also:
- Constant Field Values
-
state
private final java.util.concurrent.atomic.AtomicInteger state
-
maxTaskExecutePerRun
private final int maxTaskExecutePerRun
-
-
Constructor Detail
-
NonStickyOrderedEventExecutor
NonStickyOrderedEventExecutor(EventExecutor executor, int maxTaskExecutePerRun)
-
-
Method Detail
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable
-
inEventLoop
public boolean inEventLoop(java.lang.Thread thread)
Description copied from interface:EventExecutorReturntrueif the givenThreadis executed in the event loop,falseotherwise.- Specified by:
inEventLoopin interfaceEventExecutor
-
inEventLoop
public boolean inEventLoop()
Description copied from interface:EventExecutorCallsEventExecutor.inEventLoop(Thread)withThread.currentThread()as argument- Specified by:
inEventLoopin interfaceEventExecutor- Overrides:
inEventLoopin classAbstractEventExecutor
-
isShuttingDown
public boolean isShuttingDown()
Description copied from interface:EventExecutorGroupReturnstrueif and only if allEventExecutors managed by thisEventExecutorGroupare being shut down gracefully or was shut down.- Specified by:
isShuttingDownin interfaceEventExecutorGroup
-
shutdownGracefully
public Future<?> shutdownGracefully(long quietPeriod, long timeout, java.util.concurrent.TimeUnit unit)
Description copied from interface:EventExecutorGroupSignals this executor that the caller wants the executor to be shut down. Once this method is called,EventExecutorGroup.isShuttingDown()starts to returntrue, and the executor prepares to shut itself down. UnlikeEventExecutorGroup.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.- Specified by:
shutdownGracefullyin interfaceEventExecutorGroup- Parameters:
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 ofquietPeriodandtimeout- Returns:
- the
EventExecutorGroup.terminationFuture()
-
terminationFuture
public Future<?> terminationFuture()
Description copied from interface:EventExecutorGroupReturns theFuturewhich is notified when allEventExecutors managed by thisEventExecutorGrouphave been terminated.- Specified by:
terminationFuturein interfaceEventExecutorGroup
-
shutdown
public void shutdown()
- Specified by:
shutdownin interfaceEventExecutorGroup- Specified by:
shutdownin interfacejava.util.concurrent.ExecutorService- Specified by:
shutdownin classAbstractEventExecutor
-
isShutdown
public boolean isShutdown()
- Specified by:
isShutdownin interfacejava.util.concurrent.ExecutorService
-
isTerminated
public boolean isTerminated()
- Specified by:
isTerminatedin interfacejava.util.concurrent.ExecutorService
-
awaitTermination
public boolean awaitTermination(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException- Specified by:
awaitTerminationin interfacejava.util.concurrent.ExecutorService- Throws:
java.lang.InterruptedException
-
execute
public void execute(java.lang.Runnable command)
- Specified by:
executein interfacejava.util.concurrent.Executor
-
-