Small code improvements

This commit is contained in:
Norman Maurer 2013-08-26 07:52:47 +02:00
parent 77d4222db5
commit 80d30c3dd8
7 changed files with 12 additions and 10 deletions

View File

@ -791,7 +791,7 @@ public abstract class AbstractChannel extends DefaultAttributeMap implements Cha
}
}
final class CloseFuture extends DefaultChannelPromise {
static final class CloseFuture extends DefaultChannelPromise {
CloseFuture(AbstractChannel ch) {
super(ch);

View File

@ -245,7 +245,7 @@ public final class ChannelOutboundBuffer {
return false;
}
Entry e = buffer[this.flushed];
Entry e = buffer[flushed];
Object msg = e.msg;
if (msg == null) {
return false;
@ -256,7 +256,7 @@ public final class ChannelOutboundBuffer {
e.clear();
this.flushed = flushed + 1 & buffer.length - 1;
flushed = flushed + 1 & buffer.length - 1;
safeRelease(msg);

View File

@ -197,7 +197,8 @@ public class EmbeddedChannel extends AbstractChannel {
flush();
for (int i = 0; i < futures.size(); i++) {
int size = futures.size();
for (int i = 0; i < size; i++) {
ChannelFuture future = (ChannelFuture) futures.get(i);
assert future.isDone();
if (future.cause() != null) {

View File

@ -293,8 +293,8 @@ public class LocalChannel extends AbstractChannel {
peerLoop.execute(new Runnable() {
@Override
public void run() {
for (Object o: msgsCopy) {
peer.inboundBuffer.add(o);
for (int i = 0; i < msgsCopy.length; i++) {
peer.inboundBuffer.add(msgsCopy[i]);
}
finishPeerRead(peer, peerPipeline);
}

View File

@ -85,7 +85,8 @@ public abstract class AbstractNioMessageChannel extends AbstractNioChannel {
exception = t;
}
for (int i = 0; i < readBuf.size(); i ++) {
int size = readBuf.size();
for (int i = 0; i < size; i ++) {
pipeline.fireChannelRead(readBuf.get(i));
}
readBuf.clear();

View File

@ -472,9 +472,8 @@ public final class NioEventLoop extends SingleThreadEventLoop {
return;
}
int readyOps = -1;
try {
readyOps = k.readyOps();
int readyOps = k.readyOps();
if ((readyOps & (SelectionKey.OP_READ | SelectionKey.OP_ACCEPT)) != 0 || readyOps == 0) {
unsafe.read();
if (!ch.isOpen()) {

View File

@ -47,7 +47,8 @@ public abstract class AbstractOioMessageChannel extends AbstractOioChannel {
exception = t;
}
for (int i = 0; i < readBuf.size(); i ++) {
int size = readBuf.size();
for (int i = 0; i < size; i ++) {
pipeline.fireChannelRead(readBuf.get(i));
}
readBuf.clear();