Clean up
* Static variables should come before member fields * Removed unused members
This commit is contained in:
parent
5c2c8d9d1d
commit
1ac6c75d39
@ -85,36 +85,40 @@ import org.jboss.netty.util.internal.ExecutorUtil;
|
||||
*/
|
||||
public class NioClientSocketChannelFactory implements ClientSocketChannelFactory {
|
||||
|
||||
private static final int DEFAULT_BOSS_COUNT = 1;
|
||||
|
||||
private final Executor bossExecutor;
|
||||
private final Executor workerExecutor;
|
||||
private final NioClientSocketPipelineSink sink;
|
||||
private static final int DEFAULT_BOSS_COUNT = 1;
|
||||
|
||||
/**
|
||||
* Creates a new instance. Calling this constructor is same with calling
|
||||
* {@link #NioClientSocketChannelFactory(Executor, Executor, int)} with 2 *
|
||||
* the number of available processors in the machine. The number of
|
||||
* {@link #NioClientSocketChannelFactory(Executor, Executor, int, int)} with
|
||||
* 1 and (2 * the number of available processors in the machine) for
|
||||
* <tt>bossCount</tt> and <tt>workerCount</tt> respectively. The number of
|
||||
* available processors is obtained by {@link Runtime#availableProcessors()}.
|
||||
*
|
||||
* @param bossExecutor
|
||||
* the {@link Executor} which will execute the boss thread
|
||||
* @param workerExecutor
|
||||
* the {@link Executor} which will execute the I/O worker threads
|
||||
* the {@link Executor} which will execute the worker threads
|
||||
*/
|
||||
public NioClientSocketChannelFactory(
|
||||
Executor bossExecutor, Executor workerExecutor) {
|
||||
this(bossExecutor, workerExecutor, SelectorUtil.DEFAULT_IO_THREADS);
|
||||
this(bossExecutor, workerExecutor, DEFAULT_BOSS_COUNT, SelectorUtil.DEFAULT_IO_THREADS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* Creates a new instance. Calling this constructor is same with calling
|
||||
* {@link #NioClientSocketChannelFactory(Executor, Executor, int, int)} with
|
||||
* 1 as <tt>bossCount</tt>.
|
||||
*
|
||||
* @param bossExecutor
|
||||
* the {@link Executor} which will execute the boss thread
|
||||
* @param workerExecutor
|
||||
* the {@link Executor} which will execute the I/O worker threads
|
||||
* the {@link Executor} which will execute the worker threads
|
||||
* @param workerCount
|
||||
* the maximum number of I/O worker threads
|
||||
* the maximum number of worker threads
|
||||
*/
|
||||
public NioClientSocketChannelFactory(
|
||||
Executor bossExecutor, Executor workerExecutor,
|
||||
@ -132,7 +136,7 @@ public class NioClientSocketChannelFactory implements ClientSocketChannelFactory
|
||||
* @param bossCount
|
||||
* the maximum number of boss threads
|
||||
* @param workerCount
|
||||
* the maximum number of I/O worker threads
|
||||
* the maximum number of worker threads
|
||||
*/
|
||||
public NioClientSocketChannelFactory(
|
||||
Executor bossExecutor, Executor workerExecutor,
|
||||
@ -157,7 +161,8 @@ public class NioClientSocketChannelFactory implements ClientSocketChannelFactory
|
||||
|
||||
this.bossExecutor = bossExecutor;
|
||||
this.workerExecutor = workerExecutor;
|
||||
sink = new NioClientSocketPipelineSink(bossExecutor, workerExecutor, bossCount, workerCount);
|
||||
sink = new NioClientSocketPipelineSink(
|
||||
bossExecutor, workerExecutor, bossCount, workerCount);
|
||||
}
|
||||
|
||||
|
||||
|
@ -58,33 +58,29 @@ class NioClientSocketPipelineSink extends AbstractChannelSink {
|
||||
static final InternalLogger logger =
|
||||
InternalLoggerFactory.getInstance(NioClientSocketPipelineSink.class);
|
||||
|
||||
private static final int DEFAULT_BOSS_COUNT = 1;
|
||||
final Executor bossExecutor;
|
||||
private final int numBosses;
|
||||
|
||||
private final Boss bosses[];
|
||||
private final NioWorker[] workers;
|
||||
|
||||
private final AtomicInteger bossIndex = new AtomicInteger();
|
||||
private final AtomicInteger workerIndex = new AtomicInteger();
|
||||
|
||||
NioClientSocketPipelineSink(Executor bossExecutor, Executor workerExecutor, int workerCount) {
|
||||
this(bossExecutor, workerExecutor, DEFAULT_BOSS_COUNT, workerCount);
|
||||
}
|
||||
|
||||
NioClientSocketPipelineSink(Executor bossExecutor, Executor workerExecutor, int bossCount, int workerCount) {
|
||||
NioClientSocketPipelineSink(
|
||||
Executor bossExecutor, Executor workerExecutor,
|
||||
int bossCount, int workerCount) {
|
||||
|
||||
this.bossExecutor = bossExecutor;
|
||||
this.numBosses = bossCount;
|
||||
|
||||
bosses = new Boss[bossCount];
|
||||
for (int i = 0; i < bosses.length; i ++) {
|
||||
bosses[i] = new Boss();
|
||||
}
|
||||
|
||||
workers = new NioWorker[workerCount];
|
||||
for (int i = 0; i < workers.length; i ++) {
|
||||
workers[i] = new NioWorker(workerExecutor);
|
||||
}
|
||||
|
||||
bosses = new Boss[numBosses];
|
||||
for (int i = 0; i < numBosses; ++i) {
|
||||
bosses[i] = new Boss();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user