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

View File

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