Created
July 6, 2012 02:42
-
-
Save trustin/3057755 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 class MyHandler extends ChannelInboundMessageHandlerAdapter<MyMessage> { | |
private static final AttributeKey<MyState> STATE = | |
new AttributeKey<MyState>("MyHandler.state"); | |
@Override | |
public void channelRegistered(ChannelHandlerContext ctx) { | |
ctx.attr(STATE).set(new MyState()); | |
ctx.fireChannelRegistered(); | |
} | |
@Override | |
public void messageReceived(ChannelHandlerContext ctx, MyMessage msg) { | |
MyState state = ctx.attr(STATE).get(); | |
} | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment