Skip to content

Commit

Permalink
Tiny optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
Norman Maurer committed Aug 9, 2013
1 parent e954eb1 commit 1547876
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,14 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception
} 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();
}
}
Expand Down Expand Up @@ -207,8 +207,8 @@ public void channelInactive(ChannelHandlerContext ctx) throws Exception {
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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception
} 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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,8 @@ public void channelInactive(ChannelHandlerContext ctx) throws Exception {
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();
Expand Down

0 comments on commit 1547876

Please sign in to comment.