Fixed compilation and removed unused fields
This commit is contained in:
parent
16750ffc28
commit
b26f13d3b9
@ -57,9 +57,7 @@ class NioClientSocketPipelineSink extends AbstractChannelSink {
|
||||
|
||||
static final InternalLogger logger =
|
||||
InternalLoggerFactory.getInstance(NioClientSocketPipelineSink.class);
|
||||
private static final AtomicInteger nextId = new AtomicInteger();
|
||||
|
||||
final int id = nextId.incrementAndGet();
|
||||
final Executor bossExecutor;
|
||||
private final Boss boss = new Boss();
|
||||
private final NioWorker[] workers;
|
||||
@ -70,7 +68,7 @@ class NioClientSocketPipelineSink extends AbstractChannelSink {
|
||||
this.bossExecutor = bossExecutor;
|
||||
workers = new NioWorker[workerCount];
|
||||
for (int i = 0; i < workers.length; i ++) {
|
||||
workers[i] = new NioWorker(id, i + 1, workerExecutor);
|
||||
workers[i] = new NioWorker(workerExecutor);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,9 +43,6 @@ import org.jboss.netty.channel.MessageEvent;
|
||||
*/
|
||||
class NioDatagramPipelineSink extends AbstractChannelSink {
|
||||
|
||||
private static final AtomicInteger nextId = new AtomicInteger();
|
||||
|
||||
private final int id = nextId.incrementAndGet();
|
||||
private final NioDatagramWorker[] workers;
|
||||
private final AtomicInteger workerIndex = new AtomicInteger();
|
||||
|
||||
@ -62,7 +59,7 @@ class NioDatagramPipelineSink extends AbstractChannelSink {
|
||||
NioDatagramPipelineSink(final Executor workerExecutor, final int workerCount) {
|
||||
workers = new NioDatagramWorker[workerCount];
|
||||
for (int i = 0; i < workers.length; i ++) {
|
||||
workers[i] = new NioDatagramWorker(id, i + 1, workerExecutor);
|
||||
workers[i] = new NioDatagramWorker(workerExecutor);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,16 +64,6 @@ class NioDatagramWorker implements Runnable {
|
||||
private static final InternalLogger logger = InternalLoggerFactory
|
||||
.getInstance(NioDatagramWorker.class);
|
||||
|
||||
/**
|
||||
* This id of this worker.
|
||||
*/
|
||||
private final int id;
|
||||
|
||||
/**
|
||||
* This id of the NioDatagramPipelineSink.
|
||||
*/
|
||||
private final int bossId;
|
||||
|
||||
/**
|
||||
* Executor used to execute {@link Runnable}s such as
|
||||
* {@link ChannelRegistionTask}.
|
||||
@ -131,14 +121,10 @@ class NioDatagramWorker implements Runnable {
|
||||
/**
|
||||
* Sole constructor.
|
||||
*
|
||||
* @param bossId This id of the NioDatagramPipelineSink
|
||||
* @param id The id of this worker
|
||||
* @param executor the {@link Executor} used to execute {@link Runnable}s
|
||||
* such as {@link ChannelRegistionTask}
|
||||
*/
|
||||
NioDatagramWorker(final int bossId, final int id, final Executor executor) {
|
||||
this.bossId = bossId;
|
||||
this.id = id;
|
||||
NioDatagramWorker(final Executor executor) {
|
||||
this.executor = executor;
|
||||
}
|
||||
|
||||
|
@ -53,16 +53,14 @@ class NioServerSocketPipelineSink extends AbstractChannelSink {
|
||||
|
||||
static final InternalLogger logger =
|
||||
InternalLoggerFactory.getInstance(NioServerSocketPipelineSink.class);
|
||||
private static final AtomicInteger nextId = new AtomicInteger();
|
||||
|
||||
private final int id = nextId.incrementAndGet();
|
||||
private final NioWorker[] workers;
|
||||
private final AtomicInteger workerIndex = new AtomicInteger();
|
||||
|
||||
NioServerSocketPipelineSink(Executor workerExecutor, int workerCount) {
|
||||
workers = new NioWorker[workerCount];
|
||||
for (int i = 0; i < workers.length; i ++) {
|
||||
workers[i] = new NioWorker(id, i + 1, workerExecutor);
|
||||
workers[i] = new NioWorker(workerExecutor);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -66,8 +66,6 @@ class NioWorker implements Runnable {
|
||||
|
||||
static final int CLEANUP_INTERVAL = 256; // XXX Hard-coded value, but won't need customization.
|
||||
|
||||
private final int bossId;
|
||||
private final int id;
|
||||
private final Executor executor;
|
||||
private boolean started;
|
||||
private volatile Thread thread;
|
||||
@ -82,9 +80,7 @@ class NioWorker implements Runnable {
|
||||
private final SocketReceiveBufferPool recvBufferPool = new SocketReceiveBufferPool();
|
||||
private final SocketSendBufferPool sendBufferPool = new SocketSendBufferPool();
|
||||
|
||||
NioWorker(int bossId, int id, Executor executor) {
|
||||
this.bossId = bossId;
|
||||
this.id = id;
|
||||
NioWorker(Executor executor) {
|
||||
this.executor = executor;
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,6 @@ import static org.jboss.netty.channel.Channels.*;
|
||||
import java.io.PushbackInputStream;
|
||||
import java.net.SocketAddress;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import org.jboss.netty.channel.AbstractChannelSink;
|
||||
import org.jboss.netty.channel.ChannelEvent;
|
||||
@ -42,9 +41,6 @@ import org.jboss.netty.util.internal.DeadLockProofWorker;
|
||||
*/
|
||||
class OioClientSocketPipelineSink extends AbstractChannelSink {
|
||||
|
||||
private static final AtomicInteger nextId = new AtomicInteger();
|
||||
|
||||
private final int id = nextId.incrementAndGet();
|
||||
private final Executor workerExecutor;
|
||||
|
||||
OioClientSocketPipelineSink(Executor workerExecutor) {
|
||||
|
@ -17,7 +17,6 @@ package org.jboss.netty.channel.socket.oio;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.RejectedExecutionException;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import org.jboss.netty.channel.Channel;
|
||||
import org.jboss.netty.channel.ChannelPipeline;
|
||||
@ -78,11 +77,8 @@ import org.jboss.netty.util.internal.ExecutorUtil;
|
||||
*/
|
||||
public class OioDatagramChannelFactory implements DatagramChannelFactory {
|
||||
|
||||
private static final AtomicInteger nextId = new AtomicInteger();
|
||||
|
||||
private final Executor workerExecutor;
|
||||
final OioDatagramPipelineSink sink;
|
||||
final int id = nextId.incrementAndGet();
|
||||
|
||||
/**
|
||||
* Creates a new instance.
|
||||
@ -95,7 +91,7 @@ public class OioDatagramChannelFactory implements DatagramChannelFactory {
|
||||
throw new NullPointerException("workerExecutor");
|
||||
}
|
||||
this.workerExecutor = workerExecutor;
|
||||
sink = new OioDatagramPipelineSink(id, workerExecutor);
|
||||
sink = new OioDatagramPipelineSink(workerExecutor);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -40,11 +40,9 @@ import org.jboss.netty.util.internal.DeadLockProofWorker;
|
||||
*/
|
||||
class OioDatagramPipelineSink extends AbstractChannelSink {
|
||||
|
||||
private final int id;
|
||||
private final Executor workerExecutor;
|
||||
|
||||
OioDatagramPipelineSink(int id, Executor workerExecutor) {
|
||||
this.id = id;
|
||||
OioDatagramPipelineSink(Executor workerExecutor) {
|
||||
this.workerExecutor = workerExecutor;
|
||||
}
|
||||
|
||||
@ -141,10 +139,6 @@ class OioDatagramPipelineSink extends AbstractChannelSink {
|
||||
}
|
||||
fireChannelConnected(channel, channel.getRemoteAddress());
|
||||
|
||||
final String service = "OldIO";
|
||||
final String category = "DatagramWorker";
|
||||
final String comment = channel.toString();
|
||||
|
||||
if (!bound) {
|
||||
// Start the business.
|
||||
DeadLockProofWorker.start(
|
||||
|
@ -24,7 +24,6 @@ import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.locks.ReadWriteLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
|
||||
@ -86,7 +85,6 @@ public class HashedWheelTimer implements Timer {
|
||||
|
||||
static final InternalLogger logger =
|
||||
InternalLoggerFactory.getInstance(HashedWheelTimer.class);
|
||||
private static final AtomicInteger id = new AtomicInteger();
|
||||
|
||||
private static final SharedResourceMisuseDetector misuseDetector =
|
||||
new SharedResourceMisuseDetector(HashedWheelTimer.class);
|
||||
@ -209,10 +207,7 @@ public class HashedWheelTimer implements Timer {
|
||||
|
||||
roundDuration = tickDuration * wheel.length;
|
||||
|
||||
workerThread = threadFactory.newThread(new ThreadRenamingRunnable(
|
||||
worker,
|
||||
"HashedWheelTimer", null, null,
|
||||
String.valueOf(id.incrementAndGet()), null));
|
||||
workerThread = threadFactory.newThread(worker);
|
||||
|
||||
// Misuse check
|
||||
misuseDetector.increase();
|
||||
|
@ -15,13 +15,13 @@
|
||||
*/
|
||||
package org.jboss.netty.util;
|
||||
|
||||
import org.jboss.netty.channel.ChannelFactory;
|
||||
import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory;
|
||||
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import org.jboss.netty.channel.ChannelFactory;
|
||||
import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory;
|
||||
|
||||
/**
|
||||
* A {@link ThreadFactory} that creates a new {@link Thread} with the specified name and thread ID.
|
||||
* This class is useful when you want to customize the name of the I/O threads:
|
||||
@ -84,6 +84,7 @@ public class NamedThreadFactory implements ThreadFactory {
|
||||
* {@inheritDoc} The name of the thread is {@code "prefix + threadId"}. (e.g. {@code "ioThread-1"} if
|
||||
* {@code prefix} is {@code "ioThread-"}.
|
||||
*/
|
||||
@Override
|
||||
public Thread newThread(Runnable r) {
|
||||
Thread t = new Thread(group, r, prefix + threadId.getAndIncrement());
|
||||
t.setDaemon(daemon);
|
||||
|
Loading…
Reference in New Issue
Block a user