Remove MultithreadEventExecutorGroup.DEFAULT_POOL_SIZE

- We should never define a default nThread for MultithreadEventExecutorGroup because we don't know what a user do with it.
This commit is contained in:
Trustin Lee 2013-04-03 17:15:25 +09:00
parent b7797917ab
commit 312a35dfed
2 changed files with 4 additions and 11 deletions

View File

@ -28,7 +28,6 @@ import java.util.concurrent.atomic.AtomicInteger;
*/
public abstract class MultithreadEventExecutorGroup extends AbstractEventExecutorGroup {
public static final int DEFAULT_POOL_SIZE = Runtime.getRuntime().availableProcessors() * 2;
private static final AtomicInteger poolId = new AtomicInteger();
private final EventExecutor[] children;
@ -37,20 +36,15 @@ public abstract class MultithreadEventExecutorGroup extends AbstractEventExecuto
/**
* Create a new instance.
*
* @param nThreads the number of threads that will be used by this instance. Use 0 for the default number
* of {@link #DEFAULT_POOL_SIZE}
* @param nThreads the number of threads that will be used by this instance.
* @param threadFactory the ThreadFactory to use, or {@code null} if the default should be used.
* @param args arguments which will passed to each {@link #newChild(ThreadFactory, Object...)} call
*/
protected MultithreadEventExecutorGroup(int nThreads, ThreadFactory threadFactory, Object... args) {
if (nThreads < 0) {
throw new IllegalArgumentException(String.format(
"nThreads: %d (expected: >= 0)", nThreads));
if (nThreads <= 0) {
throw new IllegalArgumentException(String.format("nThreads: %d (expected: > 0)", nThreads));
}
if (nThreads == 0) {
nThreads = DEFAULT_POOL_SIZE;
}
if (threadFactory == null) {
threadFactory = new DefaultThreadFactory();
}

View File

@ -28,8 +28,7 @@ public abstract class MultithreadEventLoopGroup extends MultithreadEventExecutor
/**
* @see {@link MultithreadEventExecutorGroup##MultithreadEventLoopGroup(int,ThreadFactory, Object...)}
*/
protected MultithreadEventLoopGroup(int nThreads, ThreadFactory threadFactory,
Object... args) {
protected MultithreadEventLoopGroup(int nThreads, ThreadFactory threadFactory, Object... args) {
super(nThreads, threadFactory, args);
}