public abstract class ChannelGroup
extends java.lang.Object
A channel group encapsulates the mechanics required to handle the completion of I/O operations initiated by channels that are bound to the group. A group has an associated thread pool which polls IO events sent by the OS.
| Constructor and Description |
|---|
ChannelGroup() |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
shutdown()
Shutdown the channel group.
|
static ChannelGroup |
withFixedThreadPool(int nThreads,
java.util.concurrent.ThreadFactory threadFactory)
Creates a channel group with a fixed thread pool.
|
static ChannelGroup |
withThreadPool(java.util.concurrent.ExecutorService executor)
Creates a channel group with a given thread pool.
|
public static ChannelGroup withFixedThreadPool(int nThreads, java.util.concurrent.ThreadFactory threadFactory) throws java.io.IOException
The resulting channel group reuses a fixed number of
threads. At any point, at most nThreads threads will be active
processing tasks that are submitted to handle I/O events and dispatch
completion results for operations initiated on channels in
the group.
nThreads - The number of threads in the poolthreadFactory - The factory to use when creating new threadsjava.lang.IllegalArgumentException - If nThreads <= 0java.io.IOException - If an I/O error occurspublic static ChannelGroup withThreadPool(java.util.concurrent.ExecutorService executor) throws java.io.IOException
executor - The thread pool for the resulting groupjava.io.IOExceptionpublic abstract void shutdown()