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 nThreads,
ThreadFactory threadFactory,
Object... args)
Create a new instance.
|
Modifier and Type | Method and Description |
---|---|
boolean |
awaitTermination(long timeout,
TimeUnit unit) |
protected Set<EventExecutor> |
children()
Return a safe-copy of all of the children of this group.
|
int |
executorCount()
Return the number of
EventExecutor this implementation uses. |
boolean |
isShutdown() |
boolean |
isShuttingDown()
|
boolean |
isTerminated() |
Iterator<EventExecutor> |
iterator()
Returns a read-only
Iterator over all EventExecutor , which are handled by this
EventExecutorGroup at the time of invoke this method. |
protected abstract EventExecutor |
newChild(ThreadFactory threadFactory,
Object... args)
Create a new EventExecutor which will later then accessible via the
next() method. |
protected ThreadFactory |
newDefaultThreadFactory() |
EventExecutor |
next()
Returns one of the
EventExecutor s that belong to this group. |
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 this executor has been terminated. |
execute, invokeAll, invokeAll, invokeAny, invokeAny, schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelay, shutdownGracefully, shutdownNow, submit, submit, submit
protected MultithreadEventExecutorGroup(int nThreads, ThreadFactory threadFactory, Object... args)
nThreads
- the number of threads that will be used by this instance.threadFactory
- the ThreadFactory to use, or null
if the default should be used.args
- arguments which will passed to each newChild(ThreadFactory, Object...)
callprotected ThreadFactory newDefaultThreadFactory()
public EventExecutor next()
EventExecutorGroup
EventExecutor
s that belong to this group.public Iterator<EventExecutor> iterator()
EventExecutorGroup
Iterator
over all EventExecutor
, which are handled by this
EventExecutorGroup
at the time of invoke this method.public final int executorCount()
EventExecutor
this implementation uses. This number is the maps
1:1 to the threads it use.protected Set<EventExecutor> children()
protected abstract EventExecutor newChild(ThreadFactory threadFactory, Object... args) throws Exception
next()
method. This method will be
called for each thread that will serve this MultithreadEventExecutorGroup
.Exception
public Future<?> shutdownGracefully(long quietPeriod, long timeout, TimeUnit unit)
EventExecutorGroup
EventExecutorGroup.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 timeout
EventExecutorGroup.terminationFuture()
public Future<?> terminationFuture()
EventExecutorGroup
Future
which is notified when this executor has been terminated.@Deprecated public void shutdown()
shutdown
in interface EventExecutorGroup
shutdown
in interface ExecutorService
shutdown
in class AbstractEventExecutorGroup
public boolean isShuttingDown()
EventExecutorGroup
public boolean isShutdown()
public boolean isTerminated()
public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException
InterruptedException
Copyright © 2008–2013 The Netty Project. All rights reserved.