Created
July 13, 2012 03:47
-
-
Save trustin/3102590 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void inboundBufferUpdated(ChannelHandlerContext ctx) { | |
Queue<MyMessage> in = ctx.inboundMessageBuffer(); | |
Queue<MyNewMessage> out = ctx.nextInboundMessageBuffer(); | |
for (;;) { | |
MyMessage m = in.poll(); | |
if (m == null) { | |
break; | |
} | |
MyNewMessage decoded = decode(m); | |
out.add(decoded); | |
} | |
ctx.fireInboundBufferUpdated(); | |
} | |
public void flush(ChannelHandlerContext ctx, ChannelFuture future) { | |
Queue<MyNewMessage> in = ctx.outboundMessageBuffer(); | |
Queue<MyMessage> out = ctx.nextOutboundMessageBuffer(); | |
for (;;) { | |
MyNewMessage m = in.poll(); | |
if (m == null) { | |
break; | |
} | |
MyMessage encoded = encode(m); | |
out.add(encoded); | |
} | |
ctx.flush(future); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment