Channel attachments?

Marc-André Laverdière marcandre.laverdiere at gmail.com
Mon Jun 14 10:34:34 EDT 2010


Yikes... that could turn to a maintainability pain. I personally
prefer to write code that works no matter what happens to the
pipeline.
Still... should we have to rely on these various workarounds? Why
can't attachments just _work_ as one would expect?

Marc-André LAVERDIÈRE
"Perseverance must finish its work so that you may be mature and
complete, not lacking anything." -James 1:4
mlaverd.theunixplace.com/blog

 /"\
 \ /    ASCII Ribbon Campaign
  X      against HTML e-mail
 / \



2010/6/11 Jesse Hutton <jesse.hutton at gmail.com>:
> On Fri, Jun 11, 2010 at 11:30 AM, Robert Wahlstedt <rob at isketch.net> wrote:
>>
>> On Jun 10, 2010, at 22:46 , blakeman8192 wrote:
>>
>> > I need a more elegant way to keep track of different objects (i.e. a
>> > Player object) for a Channel.
>> > Is this overlooked in the Netty design, or (more likely) am I missing
>> > something?
>>
>> 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.
>>
>> 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()
>>
>>
>> /Rob
>
>
> 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.
> Jesse
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users
>



More information about the netty-users mailing list