Renamed NioUdpWorker to NioDatagramWork

This commit is contained in:
Trustin Lee 2009-06-12 02:47:57 +00:00
parent 08107683b3
commit 7a4f00201a
3 changed files with 27 additions and 27 deletions

View File

@ -65,9 +65,9 @@ class NioDatagramChannel extends AbstractChannel
private final NioDatagramChannelConfig config;
/**
* The {@link NioUdpWorker} for this NioDatagramChannnel.
* The {@link NioDatagramWorker} for this NioDatagramChannnel.
*/
final NioUdpWorker worker;
final NioDatagramWorker worker;
/**
* The {@link DatagramChannel} that this channel uses.
@ -122,7 +122,7 @@ class NioDatagramChannel extends AbstractChannel
NioDatagramChannel(final ChannelFactory factory,
final ChannelPipeline pipeline, final ChannelSink sink,
final NioUdpWorker worker) {
final NioDatagramWorker worker) {
super(null, factory, pipeline, sink);
this.worker = worker;
datagramChannel = openNonBlockingChannel();
@ -294,7 +294,7 @@ class NioDatagramChannel extends AbstractChannel
}
/**
* WriteTask is a simple runnable performs writes by delegating the {@link NioUdpWorker}.
* WriteTask is a simple runnable performs writes by delegating the {@link NioDatagramWorker}.
*
*/
private final class WriteTask implements Runnable {
@ -304,7 +304,7 @@ class NioDatagramChannel extends AbstractChannel
public void run() {
writeTaskInTaskQueue.set(false);
NioUdpWorker.write(NioDatagramChannel.this, false);
NioDatagramWorker.write(NioDatagramChannel.this, false);
}
}

View File

@ -41,7 +41,7 @@ import org.jboss.netty.channel.MessageEvent;
/**
* NioDatagramPipelineSink receives downstream events from a ChannelPipeline.
* <p/>
* A {@link NioDatagramPipelineSink} contains an array of {@link NioUdpWorker}s
* A {@link NioDatagramPipelineSink} contains an array of {@link NioDatagramWorker}s
*
* @author The Netty Project (netty-dev@lists.jboss.org)
* @author Trustin Lee (tlee@redhat.com)
@ -55,21 +55,21 @@ class NioDatagramPipelineSink extends AbstractChannelSink {
private final int id = nextId.incrementAndGet();
private final NioUdpWorker[] workers;
private final NioDatagramWorker[] workers;
private final AtomicInteger workerIndex = new AtomicInteger();
/**
* Creates a new {@link NioDatagramPipelineSink} with a the number of {@link NioUdpWorker}s specified in workerCount.
* The {@link NioUdpWorker}s take care of reading and writing for the {@link NioDatagramChannel}.
* Creates a new {@link NioDatagramPipelineSink} with a the number of {@link NioDatagramWorker}s specified in workerCount.
* The {@link NioDatagramWorker}s take care of reading and writing for the {@link NioDatagramChannel}.
*
* @param workerExecutor
* @param workerCount The number of UdpWorkers for this sink.
*/
NioDatagramPipelineSink(final Executor workerExecutor, final int workerCount) {
workers = new NioUdpWorker[workerCount];
workers = new NioDatagramWorker[workerCount];
for (int i = 0; i < workers.length; i ++) {
workers[i] = new NioUdpWorker(id, i + 1, workerExecutor);
workers[i] = new NioDatagramWorker(id, i + 1, workerExecutor);
}
}
@ -91,25 +91,25 @@ class NioDatagramPipelineSink extends AbstractChannelSink {
switch (state) {
case OPEN:
if (Boolean.FALSE.equals(value)) {
NioUdpWorker.close(channel, future);
NioDatagramWorker.close(channel, future);
}
break;
case BOUND:
if (value != null) {
bind(channel, future, (InetSocketAddress) value);
} else {
NioUdpWorker.close(channel, future);
NioDatagramWorker.close(channel, future);
}
break;
case CONNECTED:
if (value != null) {
connect(channel, future, (InetSocketAddress) value);
} else {
NioUdpWorker.disconnect(channel, future);
NioDatagramWorker.disconnect(channel, future);
}
break;
case INTEREST_OPS:
NioUdpWorker.setInterestOps(channel, future, ((Integer) value)
NioDatagramWorker.setInterestOps(channel, future, ((Integer) value)
.intValue());
break;
}
@ -117,7 +117,7 @@ class NioDatagramPipelineSink extends AbstractChannelSink {
final MessageEvent event = (MessageEvent) e;
final boolean offered = channel.writeBufferQueue.offer(event);
assert offered;
NioUdpWorker.write(channel, true);
NioDatagramWorker.write(channel, true);
}
}
@ -196,12 +196,12 @@ class NioDatagramPipelineSink extends AbstractChannelSink {
fireExceptionCaught(channel, t);
} finally {
if (connected && !workerStarted) {
NioUdpWorker.close(channel, future);
NioDatagramWorker.close(channel, future);
}
}
}
NioUdpWorker nextWorker() {
NioDatagramWorker nextWorker() {
return workers[Math.abs(workerIndex.getAndIncrement() % workers.length)];
}

View File

@ -57,7 +57,7 @@ import org.jboss.netty.util.ThreadRenamingRunnable;
import org.jboss.netty.util.internal.LinkedTransferQueue;
/**
* NioUdpWorker is responsible for registering channels with selector, and
* NioDatagramWorker is responsible for registering channels with selector, and
* also manages the select process.
*
* @author The Netty Project (netty-dev@lists.jboss.org)
@ -66,12 +66,12 @@ import org.jboss.netty.util.internal.LinkedTransferQueue;
*
* @version $Rev$, $Date$
*/
class NioUdpWorker implements Runnable {
class NioDatagramWorker implements Runnable {
/**
* Internal Netty logger.
*/
private static final InternalLogger logger = InternalLoggerFactory
.getInstance(NioUdpWorker.class);
.getInstance(NioDatagramWorker.class);
/**
* This id of this worker.
@ -139,7 +139,7 @@ class NioUdpWorker implements Runnable {
* @param id The id of this worker.
* @param executor Executor used to exeucte runnables such as {@link ChannelRegistionTask}.
*/
NioUdpWorker(final int bossId, final int id, final Executor executor) {
NioDatagramWorker(final int bossId, final int id, final Executor executor) {
this.bossId = bossId;
this.id = id;
this.executor = executor;
@ -454,7 +454,7 @@ class NioUdpWorker implements Runnable {
private static boolean scheduleWriteIfNecessary(
final NioDatagramChannel channel) {
final NioUdpWorker worker = channel.worker;
final NioDatagramWorker worker = channel.worker;
final Thread workerThread = worker.thread;
if (workerThread == null || Thread.currentThread() != workerThread) {
@ -568,7 +568,7 @@ class NioUdpWorker implements Runnable {
}
private static void setOpWrite(final NioDatagramChannel channel) {
NioUdpWorker worker = channel.worker;
NioDatagramWorker worker = channel.worker;
Selector selector = worker.selector;
SelectionKey key = channel.getDatagramChannel().keyFor(selector);
if (key == null) {
@ -598,7 +598,7 @@ class NioUdpWorker implements Runnable {
}
private static void clearOpWrite(NioDatagramChannel channel) {
NioUdpWorker worker = channel.worker;
NioDatagramWorker worker = channel.worker;
Selector selector = worker.selector;
SelectionKey key = channel.getDatagramChannel().keyFor(selector);
if (key == null) {
@ -643,7 +643,7 @@ class NioUdpWorker implements Runnable {
static void close(final NioDatagramChannel channel,
final ChannelFuture future) {
NioUdpWorker worker = channel.worker;
NioDatagramWorker worker = channel.worker;
Selector selector = worker.selector;
SelectionKey key = channel.getDatagramChannel().keyFor(selector);
if (key != null) {
@ -727,7 +727,7 @@ class NioUdpWorker implements Runnable {
// interestOps can change at any time and by any thread.
// Acquire a lock to avoid possible race condition.
synchronized (channel.interestOpsLock) {
final NioUdpWorker worker = channel.worker;
final NioDatagramWorker worker = channel.worker;
final Selector selector = worker.selector;
final SelectionKey key = channel.getDatagramChannel().keyFor(selector);