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) {
|
CloseFuture(AbstractChannel ch) {
|
||||||
super(ch);
|
super(ch);
|
||||||
|
@ -245,7 +245,7 @@ public final class ChannelOutboundBuffer {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Entry e = buffer[this.flushed];
|
Entry e = buffer[flushed];
|
||||||
Object msg = e.msg;
|
Object msg = e.msg;
|
||||||
if (msg == null) {
|
if (msg == null) {
|
||||||
return false;
|
return false;
|
||||||
@ -256,7 +256,7 @@ public final class ChannelOutboundBuffer {
|
|||||||
|
|
||||||
e.clear();
|
e.clear();
|
||||||
|
|
||||||
this.flushed = flushed + 1 & buffer.length - 1;
|
flushed = flushed + 1 & buffer.length - 1;
|
||||||
|
|
||||||
safeRelease(msg);
|
safeRelease(msg);
|
||||||
|
|
||||||
|
@ -197,7 +197,8 @@ public class EmbeddedChannel extends AbstractChannel {
|
|||||||
|
|
||||||
flush();
|
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);
|
ChannelFuture future = (ChannelFuture) futures.get(i);
|
||||||
assert future.isDone();
|
assert future.isDone();
|
||||||
if (future.cause() != null) {
|
if (future.cause() != null) {
|
||||||
|
@ -293,8 +293,8 @@ public class LocalChannel extends AbstractChannel {
|
|||||||
peerLoop.execute(new Runnable() {
|
peerLoop.execute(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
for (Object o: msgsCopy) {
|
for (int i = 0; i < msgsCopy.length; i++) {
|
||||||
peer.inboundBuffer.add(o);
|
peer.inboundBuffer.add(msgsCopy[i]);
|
||||||
}
|
}
|
||||||
finishPeerRead(peer, peerPipeline);
|
finishPeerRead(peer, peerPipeline);
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,8 @@ public abstract class AbstractNioMessageChannel extends AbstractNioChannel {
|
|||||||
exception = t;
|
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));
|
pipeline.fireChannelRead(readBuf.get(i));
|
||||||
}
|
}
|
||||||
readBuf.clear();
|
readBuf.clear();
|
||||||
|
@ -472,9 +472,8 @@ public final class NioEventLoop extends SingleThreadEventLoop {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int readyOps = -1;
|
|
||||||
try {
|
try {
|
||||||
readyOps = k.readyOps();
|
int readyOps = k.readyOps();
|
||||||
if ((readyOps & (SelectionKey.OP_READ | SelectionKey.OP_ACCEPT)) != 0 || readyOps == 0) {
|
if ((readyOps & (SelectionKey.OP_READ | SelectionKey.OP_ACCEPT)) != 0 || readyOps == 0) {
|
||||||
unsafe.read();
|
unsafe.read();
|
||||||
if (!ch.isOpen()) {
|
if (!ch.isOpen()) {
|
||||||
|
@ -47,7 +47,8 @@ public abstract class AbstractOioMessageChannel extends AbstractOioChannel {
|
|||||||
exception = t;
|
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));
|
pipeline.fireChannelRead(readBuf.get(i));
|
||||||
}
|
}
|
||||||
readBuf.clear();
|
readBuf.clear();
|
||||||
|
Loading…
Reference in New Issue
Block a user