I found what I was looking for - a brief example of ChannelLocal is found in the ChannelHandler documentation (ps: it might be worth repeating in the ChannelLocal docs..)  But now I&#39;m wondering:<div><br></div><div>The example shows a DataServerState class - where would that class be instantiated such that all handlers have access to it?  I thought I might instantiate it in my server startup code, pass it to the ChannelPipelineFactory where I could pass it on to the constructor of each ChannelHandler.  Is there another way?</div>
<div><br></div><div>Also, at some point before the Channel closes would I have to be sure to remove any ChannelLocal variable references?  That is, ChannelLocals map values to Channels, so would I have to be sure to remove each reference so values to closed Channels don&#39;t pile up, creating a memory leak?  If so, how/where could I attach an event handler to a Channel to do this?  Would I have to do this in a ChannelHandler (I don&#39;t like that idea, because which ChannelHandler do I put it in?) or create some kind of custom ChannelFactory?</div>
<div><br></div><div>Thanks.</div><div><br></div><div>MD</div><div><br></div><div><div><br><div class="gmail_quote">On Fri, Oct 21, 2011 at 3:36 AM, Norman Maurer <span dir="ltr">&lt;<a href="mailto:norman.maurer@googlemail.com">norman.maurer@googlemail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">I was using it before in a project but remoted it in favor of<br>
ChannelHandlerContext.setAttachment(..).<br>
<br>
But it worked quited fine for me. You can see the old code here:<br>
<br>
<a href="http://svn.apache.org/viewvc/james/protocols/tags/protocols-1.5/impl/src/main/java/org/apache/james/protocols/impl/AbstractChannelUpstreamHandler.java?view=markup" target="_blank">http://svn.apache.org/viewvc/james/protocols/tags/protocols-1.5/impl/src/main/java/org/apache/james/protocols/impl/AbstractChannelUpstreamHandler.java?view=markup</a><br>

<br>
Bye,<br>
<font color="#888888">Norman<br>
</font><br>
Ps: What does not work for you ?<br>
<br>
2011/10/21 Matt DeLuco &lt;<a href="mailto:list_usr@spacebox.net">list_usr@spacebox.net</a>&gt;:<br>
<div><div></div><div class="h5">&gt; Where can I find some examples of ChannelLocal in use?<br>
&gt; I&#39;m not getting the results I expect, but I don&#39;t think I&#39;m using it<br>
&gt; correctly either.<br>
&gt; MD<br>
&gt;<br>
&gt; On Sun, Oct 16, 2011 at 7:14 AM, Norman Maurer<br>
&gt; &lt;<a href="mailto:norman.maurer@googlemail.com">norman.maurer@googlemail.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; You can set anything you want as attachment. But it&#39;s only visible in<br>
&gt;&gt; the same handler....<br>
&gt;&gt;<br>
&gt;&gt; If you want to share stuff between handler you should checkout<br>
&gt;&gt; ChannelLocal<br>
&gt;&gt;<br>
&gt;&gt; Bye<br>
&gt;&gt; Norman<br>
&gt;&gt; 2011/10/16, Matt DeLuco &lt;<a href="mailto:list_usr@spacebox.net">list_usr@spacebox.net</a>&gt;:<br>
&gt;&gt; &gt; Before composing this message I had noticed<br>
&gt;&gt; &gt; ChannelHandlerContext.setAttachment(Object) and getAttachment().  But<br>
&gt;&gt; &gt; for some reason I came to the conclusion that it wasn&#39;t intended for<br>
&gt;&gt; &gt; what I want to do.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; I came to that conclusion in part because I found it strange that it&#39;s<br>
&gt;&gt; &gt; only possible to set one attachment, rather than being able to attach<br>
&gt;&gt; &gt; a set (or map) of objects.  Could I just attach a map to the context<br>
&gt;&gt; &gt; and store whatever I want in that map, to pass objects between<br>
&gt;&gt; &gt; ChannelHandlers?<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; MD<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; On Sat, Oct 15, 2011 at 9:42 PM, Matt DeLuco &lt;<a href="mailto:list_usr@spacebox.net">list_usr@spacebox.net</a>&gt;<br>
&gt;&gt; &gt; wrote:<br>
&gt;&gt; &gt;&gt; Is it possible to pass data between ChannelHandlers, or store data<br>
&gt;&gt; &gt;&gt; somewhere that the handlers in a specific pipeline/channel can access<br>
&gt;&gt; &gt;&gt; throughout the lifetime of the request?<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; For example, I have my own class for dealing with http cookies,<br>
&gt;&gt; &gt;&gt; &quot;CookieMap&quot;.  I&#39;d like to have a SimpleChannelHandler that creates a<br>
&gt;&gt; &gt;&gt; CookieMap to be used by handlers further upstream, and then sets the<br>
&gt;&gt; &gt;&gt; cookies in the CookieMap on the response on their way back downstream.<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; MD<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; _______________________________________________<br>
&gt;&gt; &gt; netty-users mailing list<br>
&gt;&gt; &gt; <a href="mailto:netty-users@lists.jboss.org">netty-users@lists.jboss.org</a><br>
&gt;&gt; &gt; <a href="https://lists.jboss.org/mailman/listinfo/netty-users" target="_blank">https://lists.jboss.org/mailman/listinfo/netty-users</a><br>
&gt;&gt; &gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; netty-users mailing list<br>
&gt;&gt; <a href="mailto:netty-users@lists.jboss.org">netty-users@lists.jboss.org</a><br>
&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/netty-users" target="_blank">https://lists.jboss.org/mailman/listinfo/netty-users</a><br>
&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; netty-users mailing list<br>
&gt; <a href="mailto:netty-users@lists.jboss.org">netty-users@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/netty-users" target="_blank">https://lists.jboss.org/mailman/listinfo/netty-users</a><br>
&gt;<br>
<br>
_______________________________________________<br>
netty-users mailing list<br>
<a href="mailto:netty-users@lists.jboss.org">netty-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/netty-users" target="_blank">https://lists.jboss.org/mailman/listinfo/netty-users</a><br>
</div></div></blockquote></div><br></div></div>