public abstract class MultithreadEventExecutorGroup extends AbstractEventExecutorGroup
EventExecutorGroup
implementations that handles their tasks with multiple threads at
the same time.限定符 | 构造器和说明 |
---|---|
protected |
MultithreadEventExecutorGroup(int nThreads,
java.util.concurrent.Executor executor,
EventExecutorChooserFactory chooserFactory,
java.lang.Object... args)
Create a new instance.
|
protected |
MultithreadEventExecutorGroup(int nThreads,
java.util.concurrent.Executor executor,
java.lang.Object... args)
Create a new instance.
|
protected |
MultithreadEventExecutorGroup(int nThreads,
java.util.concurrent.ThreadFactory threadFactory,
java.lang.Object... args)
Create a new instance.
|
限定符和类型 | 方法和说明 |
---|---|
boolean |
awaitTermination(long timeout,
java.util.concurrent.TimeUnit unit) |
int |
executorCount()
Return the number of
EventExecutor this implementation uses. |
boolean |
isShutdown() |
boolean |
isShuttingDown()
Returns
true if and only if all EventExecutor s managed by this EventExecutorGroup
are being shut down gracefully or was shut down. |
boolean |
isTerminated() |
java.util.Iterator<EventExecutor> |
iterator() |
protected abstract EventExecutor |
newChild(java.util.concurrent.Executor executor,
java.lang.Object... args)
Create a new EventExecutor which will later then accessible via the
next() method. |
protected java.util.concurrent.ThreadFactory |
newDefaultThreadFactory() |
EventExecutor |
next()
Returns one of the
EventExecutor s managed by this EventExecutorGroup . |
void |
shutdown()
已过时。
|
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 the
Future which is notified when all EventExecutor s managed by this
EventExecutorGroup have been terminated. |
execute, invokeAll, invokeAll, invokeAny, invokeAny, schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelay, shutdownGracefully, shutdownNow, submit, submit, submit
protected MultithreadEventExecutorGroup(int nThreads, java.util.concurrent.ThreadFactory threadFactory, java.lang.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(Executor, Object...)
callprotected MultithreadEventExecutorGroup(int nThreads, java.util.concurrent.Executor executor, java.lang.Object... args)
nThreads
- the number of threads that will be used by this instance.executor
- the Executor to use, or null
if the default should be used.args
- arguments which will passed to each newChild(Executor, Object...)
callprotected MultithreadEventExecutorGroup(int nThreads, java.util.concurrent.Executor executor, EventExecutorChooserFactory chooserFactory, java.lang.Object... args)
nThreads
- the number of threads that will be used by this instance.executor
- the Executor to use, or null
if the default should be used.chooserFactory
- the EventExecutorChooserFactory
to use.args
- arguments which will passed to each newChild(Executor, Object...)
callprotected java.util.concurrent.ThreadFactory newDefaultThreadFactory()
public EventExecutor next()
EventExecutorGroup
EventExecutor
s managed by this EventExecutorGroup
.public java.util.Iterator<EventExecutor> iterator()
public final int executorCount()
EventExecutor
this implementation uses. This number is the maps
1:1 to the threads it use.protected abstract EventExecutor newChild(java.util.concurrent.Executor executor, java.lang.Object... args) throws java.lang.Exception
next()
method. This method will be
called for each thread that will serve this MultithreadEventExecutorGroup
.java.lang.Exception
public Future<?> shutdownGracefully(long quietPeriod, long timeout, java.util.concurrent.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 all EventExecutor
s managed by this
EventExecutorGroup
have been terminated.@Deprecated public void shutdown()
shutdown
在接口中 EventExecutorGroup
shutdown
在接口中 java.util.concurrent.ExecutorService
shutdown
在类中 AbstractEventExecutorGroup
public boolean isShuttingDown()
EventExecutorGroup
true
if and only if all EventExecutor
s managed by this EventExecutorGroup
are being shut down gracefully or was shut down.public boolean isShutdown()
public boolean isTerminated()
public boolean awaitTermination(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
java.lang.InterruptedException