Tiny optimizations

This commit is contained in:
Norman Maurer 2013-08-09 08:24:24 +02:00
parent e954eb1c20
commit 1547876e97
3 changed files with 12 additions and 10 deletions

View File

@ -165,14 +165,14 @@ public abstract class ByteToMessageDecoder extends ChannelInboundHandlerAdapter
} catch (Throwable t) {
throw new DecoderException(t);
} finally {
if (out.isEmpty()) {
int size = out.size();
if (size == 0) {
decodeWasNull = true;
} else {
for (int i = 0; i < size; i ++) {
ctx.fireChannelRead(out.get(i));
}
}
for (int i = 0; i < out.size(); i ++) {
ctx.fireChannelRead(out.get(i));
}
out.recycle();
}
}
@ -207,8 +207,8 @@ public abstract class ByteToMessageDecoder extends ChannelInboundHandlerAdapter
cumulation.release();
cumulation = null;
}
for (int i = 0; i < out.size(); i ++) {
int size = out.size();
for (int i = 0; i < size; i ++) {
ctx.fireChannelRead(out.get(i));
}
ctx.fireChannelInactive();

View File

@ -98,7 +98,8 @@ public abstract class MessageToMessageDecoder<I> extends ChannelInboundHandlerAd
} catch (Exception e) {
throw new DecoderException(e);
} finally {
for (int i = 0; i < out.size(); i ++) {
int size = out.size();
for (int i = 0; i < size; i ++) {
ctx.fireChannelRead(out.get(i));
}
out.recycle();

View File

@ -340,7 +340,8 @@ public abstract class ReplayingDecoder<S> extends ByteToMessageDecoder {
cumulation = null;
}
for (int i = 0; i < out.size(); i ++) {
int size = out.size();
for (int i = 0; i < size; i ++) {
ctx.fireChannelRead(out.get(i));
}
ctx.fireChannelInactive();