[#557] Provide pre/post handler methods to ChannelInboundMessageHandler.inboundBufferUpdated()

- Add pre- and post- handler methods
This commit is contained in:
Trustin Lee 2012-08-24 17:25:07 +09:00
parent c9174e0733
commit ba6c032180

View File

@ -28,6 +28,8 @@ public abstract class ChannelInboundMessageHandlerAdapter<I>
@Override @Override
public final void inboundBufferUpdated(ChannelHandlerContext ctx) throws Exception { public final void inboundBufferUpdated(ChannelHandlerContext ctx) throws Exception {
firstMessageReceived(ctx);
MessageBuf<I> in = ctx.inboundMessageBuffer(); MessageBuf<I> in = ctx.inboundMessageBuffer();
for (;;) { for (;;) {
I msg = in.poll(); I msg = in.poll();
@ -40,7 +42,11 @@ public abstract class ChannelInboundMessageHandlerAdapter<I>
ctx.fireExceptionCaught(t); ctx.fireExceptionCaught(t);
} }
} }
lastMessageReceived(ctx);
} }
public void firstMessageReceived(ChannelHandlerContext ctx) throws Exception { }
public abstract void messageReceived(ChannelHandlerContext ctx, I msg) throws Exception; public abstract void messageReceived(ChannelHandlerContext ctx, I msg) throws Exception;
public void lastMessageReceived(ChannelHandlerContext ctx) throws Exception { }
} }