From 312a35dfedad5e999e980a5adc9916b3d7b2ea3b Mon Sep 17 00:00:00 2001 From: Trustin Lee Date: Wed, 3 Apr 2013 17:15:25 +0900 Subject: [PATCH] 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. --- .../concurrent/MultithreadEventExecutorGroup.java | 12 +++--------- .../io/netty/channel/MultithreadEventLoopGroup.java | 3 +-- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/common/src/main/java/io/netty/util/concurrent/MultithreadEventExecutorGroup.java b/common/src/main/java/io/netty/util/concurrent/MultithreadEventExecutorGroup.java index 87140dd5ec..bf098552f9 100644 --- a/common/src/main/java/io/netty/util/concurrent/MultithreadEventExecutorGroup.java +++ b/common/src/main/java/io/netty/util/concurrent/MultithreadEventExecutorGroup.java @@ -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(); } diff --git a/transport/src/main/java/io/netty/channel/MultithreadEventLoopGroup.java b/transport/src/main/java/io/netty/channel/MultithreadEventLoopGroup.java index c93f75b688..7ad64332ee 100644 --- a/transport/src/main/java/io/netty/channel/MultithreadEventLoopGroup.java +++ b/transport/src/main/java/io/netty/channel/MultithreadEventLoopGroup.java @@ -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); }