<div>On Fri, Jun 11, 2010 at 11:30 AM, Robert Wahlstedt <span dir="ltr"><<a href="mailto:rob@isketch.net">rob@isketch.net</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im"><br>
On Jun 10, 2010, at 22:46 , blakeman8192 wrote:<br>
<br>
> I need a more elegant way to keep track of different objects (i.e. a Player object) for a Channel.<br>
> Is this overlooked in the Netty design, or (more likely) am I missing something?<br>
<br>
</div>This is probably a very common functionality needed when building Netty based programs. More attention in the javadocs/documentation for best practices would be nice.<br>
<br>
I have solved it simply by subclassing DefaultChannelPipeline and putting the variables I need there. That way all of my handlers can access it by ChannelHandlerContext.getPipeline()<br>
<br>
<br>
/Rob</blockquote><div><br></div><div> </div>Just to add one more variation on the theme, my approach was to add whatever state variables I needed to the final upstream handler in my pipeline factory. Then, to get access I can do channel.getPipeline().getLast(), casting it to the appropriate class.<div>
<br></div><div>Jesse </div></div></div>