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,AutoCloseable,Iterable<EventExecutor>,Runnable,Executor,ExecutorService,ScheduledExecutorService
- Enclosing class:
NonStickyEventExecutorGroup
private static final class NonStickyEventExecutorGroup.NonStickyOrderedEventExecutor
extends AbstractEventExecutor
implements Runnable, OrderedEventExecutor
-
Nested Class Summary
Nested classes/interfaces inherited from class io.netty.util.concurrent.AbstractEventExecutor
AbstractEventExecutor.LazyRunnable -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AtomicReference<Thread> private final EventExecutorprivate final intprivate static final intprivate static final intprivate final AtomicIntegerprivate static final intFields inherited from class io.netty.util.concurrent.AbstractEventExecutor
DEFAULT_SHUTDOWN_QUIET_PERIOD, DEFAULT_SHUTDOWN_TIMEOUT -
Constructor Summary
ConstructorsConstructorDescriptionNonStickyOrderedEventExecutor(EventExecutor executor, int maxTaskExecutePerRun) -
Method Summary
Modifier and TypeMethodDescriptionbooleanawaitTermination(long timeout, TimeUnit unit) voidbooleaninEventLoop(Thread thread) booleanbooleanReturnstrueif and only if allEventExecutors managed by thisEventExecutorGroupare being shut down gracefully or was shut down.booleanvoidrun()voidshutdown()Future<?> shutdownGracefully(long quietPeriod, long timeout, TimeUnit unit) Signals this executor that the caller wants the executor to be shut down.Future<?> Returns theFuturewhich is notified when allEventExecutors managed by thisEventExecutorGrouphave been terminated.Methods inherited from class io.netty.util.concurrent.AbstractEventExecutor
inEventLoop, iterator, lazyExecute, newFailedFuture, newProgressivePromise, newPromise, newSucceededFuture, newTaskFor, newTaskFor, next, parent, runTask, safeExecute, schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelay, shutdownGracefully, shutdownNow, submit, submit, submitMethods 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 io.netty.util.concurrent.EventExecutor
inEventLoop, newFailedFuture, newProgressivePromise, newPromise, newSucceededFuture, next, parentMethods inherited from interface io.netty.util.concurrent.EventExecutorGroup
iterator, schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelay, shutdownGracefully, shutdownNow, submit, submit, submitMethods inherited from interface java.util.concurrent.ExecutorService
close, invokeAll, invokeAll, invokeAny, invokeAnyMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
executor
-
tasks
-
NONE
private static final int NONE- See Also:
-
SUBMITTED
private static final int SUBMITTED- See Also:
-
RUNNING
private static final int RUNNING- See Also:
-
state
-
maxTaskExecutePerRun
private final int maxTaskExecutePerRun -
executingThread
-
-
Constructor Details
-
NonStickyOrderedEventExecutor
NonStickyOrderedEventExecutor(EventExecutor executor, int maxTaskExecutePerRun)
-
-
Method Details
-
run
public void run() -
inEventLoop
Description copied from interface:EventExecutor- Specified by:
inEventLoopin interfaceEventExecutor
-
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
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
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 interfaceExecutorService- Specified by:
shutdownin classAbstractEventExecutor
-
isShutdown
public boolean isShutdown()- Specified by:
isShutdownin interfaceExecutorService
-
isTerminated
public boolean isTerminated()- Specified by:
isTerminatedin interfaceExecutorService
-
awaitTermination
- Specified by:
awaitTerminationin interfaceExecutorService- Throws:
InterruptedException
-
execute
-