Small code improvements
This commit is contained in:
parent
77d4222db5
commit
80d30c3dd8
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -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()) {
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user