public abstract class MultithreadEventExecutorGroup extends AbstractEventExecutorGroup
EventExecutorGroup implementations that handles their tasks with multiple threads at
the same time.| Modifier | Constructor and Description |
|---|---|
protected |
MultithreadEventExecutorGroup(int nEventExecutors,
Executor executor,
Object... args) |
protected |
MultithreadEventExecutorGroup(int nEventExecutors,
ExecutorServiceFactory executorServiceFactory,
Object... args) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long timeout,
TimeUnit unit) |
<E extends EventExecutor> |
children()
Returns the unmodifiable set of
EventExecutors managed by this EventExecutorGroup. |
int |
executorCount()
Return the number of
EventExecutor this implementation uses. |
boolean |
isShutdown() |
boolean |
isShuttingDown()
Returns
true if and only if all EventExecutors managed by this EventExecutorGroup
are being shut down gracefuclly or was shut down. |
boolean |
isTerminated() |
protected abstract EventExecutor |
newChild(Executor executor,
Object... args)
Create a new EventExecutor which will later then accessible via the
next() method. |
protected ExecutorService |
newDefaultExecutorService(int nEventExecutors) |
EventExecutor |
next()
Returns one of the
EventExecutors managed by this EventExecutorGroup. |
void |
shutdown()
Deprecated.
|
Future<?> |
shutdownGracefully(long quietPeriod,
long timeout,
TimeUnit unit)
Signals this executor that the caller wants the executor to be shut down.
|
Future<?> |
terminationFuture()
Returns the
Future which is notified when all EventExecutors managed by this
EventExecutorGroup have been terminated. |
close, execute, invokeAll, invokeAll, invokeAny, invokeAny, schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelay, shutdownGracefully, shutdownNow, submit, submit, submitprotected MultithreadEventExecutorGroup(int nEventExecutors,
ExecutorServiceFactory executorServiceFactory,
Object... args)
nEventExecutors - the number of EventExecutors that will be used by this instance.
If executor is null this number will also be the parallelism
requested from the default executor. It is generally advised for the number
of EventExecutors and the number of Threads used by the
executor to lie very close together.executorServiceFactory - the ExecutorServiceFactory to use, or null if the default
should be used.args - arguments which will passed to each newChild(Executor, Object...) call.protected MultithreadEventExecutorGroup(int nEventExecutors,
Executor executor,
Object... args)
nEventExecutors - the number of EventExecutors that will be used by this instance.
If executor is null this number will also be the parallelism
requested from the default executor. It is generally advised for the number
of EventExecutors and the number of Threads used by the
executor to lie very close together.executor - the Executor to use, or null if the default should be used.args - arguments which will passed to each newChild(Executor, Object...) callprotected ExecutorService newDefaultExecutorService(int nEventExecutors)
public EventExecutor next()
EventExecutorGroupEventExecutors managed by this EventExecutorGroup.public final int executorCount()
EventExecutor this implementation uses. This number is the maps
1:1 to the threads it use.public final <E extends EventExecutor> Set<E> children()
EventExecutorGroupEventExecutors managed by this EventExecutorGroup.protected abstract EventExecutor newChild(Executor executor, Object... args) throws Exception
next() method. This method will be
called for each thread that will serve this MultithreadEventExecutorGroup.Exceptionpublic Future<?> shutdownGracefully(long quietPeriod, long timeout, TimeUnit unit)
EventExecutorGroupEventExecutorGroup.isShuttingDown() starts to return true, and the executor prepares to shut itself down.
Unlike EventExecutorGroup.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.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 of quietPeriod and timeoutEventExecutorGroup.terminationFuture()public Future<?> terminationFuture()
EventExecutorGroupFuture which is notified when all EventExecutors managed by this
EventExecutorGroup have been terminated.@Deprecated public void shutdown()
shutdown in interface EventExecutorGroupshutdown in interface ExecutorServiceshutdown in class AbstractEventExecutorGrouppublic boolean isShuttingDown()
EventExecutorGrouptrue if and only if all EventExecutors managed by this EventExecutorGroup
are being shut down gracefuclly or was shut down.public boolean isShutdown()
public boolean isTerminated()
public boolean awaitTermination(long timeout,
TimeUnit unit)
throws InterruptedException
InterruptedExceptionCopyright © 2008–2015 The Netty Project. All rights reserved.