public static AsynchronousChannelGroup withFixedThreadPool (int nThreads, ThreadFactory threadFactory) throws IOException

Creates an asynchronous channel group with a fixed thread pool.

The resulting asynchronous 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 asynchronous channels in the group.

The group is created by invoking the AsynchronousChannelProvider.openAsynchronousChannelGroup(int,ThreadFactory) method of the system-wide default AsynchronousChannelProvider object.

Parameters:
nThreads     The number of threads in the pool
threadFactory     The factory to use when creating new threads

Returns:  A new asynchronous channel group

Exceptions:
IllegalArgumentException     If nThreads <= 0
IOException     If an I/O error occurs