<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:thr="http://purl.org/syndication/thread/1.0">
	<id>tag:n2.nabble.com,2006:forum-685700</id>
	<title>Nabble - Netty User Group</title>
	<updated>2009-11-07T15:22:39Z</updated>
	<link rel="self" type="application/atom+xml" href="http://n2.nabble.com/Netty-User-Group-f685700.xml" />
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/Netty-User-Group-f685700.html" />
	<subtitle type="html">End user questions and answers are posted here.</subtitle>
	
<entry>
	<id>tag:n2.nabble.com,2006:post-3966143</id>
	<title>Announcing LittleProxy 0.2 based on Netty</title>
	<published>2009-11-07T15:22:39Z</published>
	<updated>2009-11-07T15:22:39Z</updated>
	<author>
		<name>Adam Fisk</name>
	</author>
	<content type="html">I just put the finishing touches on LittleProxy 0.2, now available at:
&lt;br&gt;&lt;br&gt;&lt;a href=&quot;http://svn.littleshoot.org/svn/littleproxy/tags/littleproxy-0.2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://svn.littleshoot.org/svn/littleproxy/tags/littleproxy-0.2&lt;/a&gt;&lt;br&gt;&lt;br&gt;This version fixes the major issues in 0.2, most notably properly
&lt;br&gt;switching HTTP 1.0 responses to use HTTP 1.1 in cases where Netty adds
&lt;br&gt;Transfer-Encoding: chunked to avoid holding large responses in memory.
&lt;br&gt;This release also properly handling Transfer-Encoding: chunked in
&lt;br&gt;requests, improvement LittleProxy's memory use, and more. You can see
&lt;br&gt;the full list or release notes/issues fixes here:
&lt;br&gt;&lt;br&gt;&lt;a href=&quot;http://bit.ly/2QjVcM&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://bit.ly/2QjVcM&lt;/a&gt;&lt;br&gt;&lt;br&gt;This release does not add the ability to decompress responses and to
&lt;br&gt;modify them. That's pushed to 0.3 in anticipation of Trustin's latest
&lt;br&gt;decompression changes, I believe planned for Netty 3.2.0.
&lt;br&gt;&lt;br&gt;Thanks again to Stephen Haberman for figuring out the fix for the HTTP
&lt;br&gt;1.0/1.1 Transfer-Encoding issue.
&lt;br&gt;&lt;br&gt;Let us know if you have anything you'd like to see added to
&lt;br&gt;LittleProxy, and we'll do our best to add it.
&lt;br&gt;&lt;br&gt;-Adam
&lt;br&gt;&lt;br&gt;&lt;br&gt;--
&lt;br&gt;Adam Fisk
&lt;br&gt;&lt;a href=&quot;http://www.littleshoot.org&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.littleshoot.org&lt;/a&gt;&amp;nbsp;| &lt;a href=&quot;http://adamfisk.wordpress.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://adamfisk.wordpress.com&lt;/a&gt;&amp;nbsp;|
&lt;br&gt;&lt;a href=&quot;http://twitter.com/adamfisk&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://twitter.com/adamfisk&lt;/a&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;netty-users mailing list
&lt;br&gt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3966143&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/Announcing-LittleProxy-0-2-based-on-Netty-tp3966143p3966143.html" />
	
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3962609</id>
	<title>Re: Section 1.9 shutting down your application</title>
	<published>2009-11-06T18:28:20Z</published>
	<updated>2009-11-06T18:28:20Z</updated>
	<author>
		<name>Trustin Lee</name>
	</author>
	<content type="html">Hi Adam,
&lt;br&gt;&lt;br&gt;Actually, they are same. I added Bootstrap.releaseExternalResources()
&lt;br&gt;for convenience. :)
&lt;br&gt;&lt;br&gt;HTH
&lt;br&gt;&lt;br&gt;— Trustin Lee, &lt;a href=&quot;http://gleamynode.net/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://gleamynode.net/&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;On Sat, Nov 7, 2009 at 9:42 AM, Adam Fisk &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3962609&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; In the docs, it looks like it should be the bootstraps calling
&lt;br&gt;&amp;gt; releaseExternalResources(), not the factories.
&lt;br&gt;&amp;gt; -Adam
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; --
&lt;br&gt;&amp;gt; Adam Fisk
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://www.littleshoot.org&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.littleshoot.org&lt;/a&gt;&amp;nbsp;| &lt;a href=&quot;http://adamfisk.wordpress.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://adamfisk.wordpress.com&lt;/a&gt;&amp;nbsp;|
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://twitter.com/adamfisk&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://twitter.com/adamfisk&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; netty-users mailing list
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3962609&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;/div&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;netty-users mailing list
&lt;br&gt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3962609&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&lt;div class=&quot;signature&quot;&gt;— Trustin Lee, &lt;a href=&quot;http://gleamynode.net/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://gleamynode.net/&lt;/a&gt;&lt;/div&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/Section-1-9-shutting-down-your-application-tp3962263p3962609.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3962263"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3962263</id>
	<title>Section 1.9 shutting down your application</title>
	<published>2009-11-06T16:42:53Z</published>
	<updated>2009-11-06T16:42:53Z</updated>
	<author>
		<name>Adam Fisk</name>
	</author>
	<content type="html">In the docs, it looks like it should be the bootstraps calling releaseExternalResources(), not the factories.&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;-Adam&lt;br clear=&quot;all&quot;&gt;&lt;br&gt;-- &lt;br&gt;Adam Fisk&lt;br&gt;&lt;a href=&quot;http://www.littleshoot.org&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.littleshoot.org&lt;/a&gt; | &lt;a href=&quot;http://adamfisk.wordpress.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://adamfisk.wordpress.com&lt;/a&gt; | &lt;a href=&quot;http://twitter.com/adamfisk&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://twitter.com/adamfisk&lt;/a&gt;&lt;br&gt;

&lt;/div&gt;
&lt;br /&gt;_______________________________________________
&lt;br&gt;netty-users mailing list
&lt;br&gt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3962263&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/Section-1-9-shutting-down-your-application-tp3962263p3962263.html" />
	
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3966051</id>
	<title>Re: Text Protocol -- Variable length, variable number of lines</title>
	<published>2009-11-07T14:54:29Z</published>
	<updated>2009-11-07T14:54:29Z</updated>
	<author>
		<name>venky10</name>
	</author>
	<content type="html">Hi,
&lt;br&gt;&lt;br&gt;In the telnet/server case each newline would trigger a MessageEvent. In my case it would be inefficient, I intend to handle MessageEvent after an X number (which is variable) of lines have been available for upstream processing to the StreamDecoder. &amp;nbsp;If I simple call --
&lt;br&gt;&lt;br&gt;&amp;nbsp; public void messageReceived(
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ChannelHandlerContext ctx, MessageEvent e) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Cast to a String first.
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// We know it is a String because we put some codec in TelnetPipelineFactory.
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; String several_lines_protocol_msg= (String) e.getMessage();
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; :::::
&lt;br&gt;}
&lt;br&gt;&lt;br&gt;&amp;nbsp;there is no guarantee that all the lines of the protocol packet have been captured in 
&lt;br&gt;&amp;quot;several_lines_protocol_msg&amp;quot;. Or is it the case that if FrameDecoder is not supplied the message received will be all the bytes available in the stream ?
&lt;br&gt;&lt;br&gt;Thanks a lot.
&lt;br&gt;Venkay
&lt;br&gt;&lt;br&gt;&lt;blockquote class=&quot;quote light-black dark-border-color&quot;&gt;&lt;div class=&quot;quote light-border-color&quot;&gt;
&lt;div class=&quot;quote-author&quot; style=&quot;font-weight: bold;&quot;&gt;Trustin Lee wrote:&lt;/div&gt;
&lt;div class=&quot;quote-message shrinkable-quote&quot;&gt;Hi Venky,
&lt;br&gt;&lt;br&gt;DelimiterBasedFrameDecoder is perhaps what you are looking for. &amp;nbsp;Also,
&lt;br&gt;please refer to the telnet client/server example.
&lt;br&gt;&lt;br&gt;HTH
&lt;br&gt;&lt;br&gt;— Trustin Lee, &lt;a href=&quot;http://gleamynode.net/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://gleamynode.net/&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;On Sat, Nov 7, 2009 at 7:11 AM, venky10 &amp;lt;vsayyagari@gmail.com&amp;gt; wrote:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Hi,
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I am a newbie to Netty.
&lt;br&gt;&amp;gt; I have text protocol to decode. It has variable number of lines, all
&lt;br&gt;&amp;gt; delimited by 'newline'.
&lt;br&gt;&amp;gt; There is no other end-of-frame delimiter. I am assuming it would be most
&lt;br&gt;&amp;gt; efficient  to read the entire frame till there are no more lines to be read
&lt;br&gt;&amp;gt; on single MessageEvent.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; What is the best approach ?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Thanks,
&lt;br&gt;&amp;gt; Venky
&lt;br&gt;&amp;gt; --
&lt;br&gt;&amp;gt; View this message in context: &lt;a href=&quot;http://n2.nabble.com/Text-Protocol-Variable-length-variable-number-of-lines-tp3961650p3961650.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://n2.nabble.com/Text-Protocol-Variable-length-variable-number-of-lines-tp3961650p3961650.html&lt;/a&gt;&lt;br&gt;&amp;gt; Sent from the Netty User Group mailing list archive at Nabble.com.
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; netty-users mailing list
&lt;br&gt;&amp;gt; netty-users@lists.jboss.org
&lt;br&gt;&amp;gt; &lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;netty-users mailing list
&lt;br&gt;netty-users@lists.jboss.org
&lt;br&gt;&lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;&lt;/blockquote&gt;
</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/Text-Protocol-Variable-length-variable-number-of-lines-tp3961650p3966051.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3963330"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3965964</id>
	<title>Re: Text Protocol -- Variable length, variable number of lines</title>
	<published>2009-11-07T14:37:32Z</published>
	<updated>2009-11-07T14:37:32Z</updated>
	<author>
		<name>venky10</name>
	</author>
	<content type="html">&lt;br&gt;&lt;blockquote class=&quot;quote light-black dark-border-color&quot;&gt;&lt;div class=&quot;quote light-border-color&quot;&gt;
&lt;div class=&quot;quote-author&quot; style=&quot;font-weight: bold;&quot;&gt;Trustin Lee wrote:&lt;/div&gt;
&lt;div class=&quot;quote-message shrinkable-quote&quot;&gt;Hi Venky,
&lt;br&gt;&lt;br&gt;DelimiterBasedFrameDecoder is perhaps what you are looking for. &amp;nbsp;Also,
&lt;br&gt;please refer to the telnet client/server example.
&lt;br&gt;&lt;br&gt;HTH
&lt;br&gt;&lt;br&gt;— Trustin Lee, &lt;a href=&quot;http://gleamynode.net/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://gleamynode.net/&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;On Sat, Nov 7, 2009 at 7:11 AM, venky10 &amp;lt;vsayyagari@gmail.com&amp;gt; wrote:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Hi,
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I am a newbie to Netty.
&lt;br&gt;&amp;gt; I have text protocol to decode. It has variable number of lines, all
&lt;br&gt;&amp;gt; delimited by 'newline'.
&lt;br&gt;&amp;gt; There is no other end-of-frame delimiter. I am assuming it would be most
&lt;br&gt;&amp;gt; efficient  to read the entire frame till there are no more lines to be read
&lt;br&gt;&amp;gt; on single MessageEvent.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; What is the best approach ?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Thanks,
&lt;br&gt;&amp;gt; Venky
&lt;br&gt;&amp;gt; --
&lt;br&gt;&amp;gt; View this message in context: &lt;a href=&quot;http://n2.nabble.com/Text-Protocol-Variable-length-variable-number-of-lines-tp3961650p3961650.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://n2.nabble.com/Text-Protocol-Variable-length-variable-number-of-lines-tp3961650p3961650.html&lt;/a&gt;&lt;br&gt;&amp;gt; Sent from the Netty User Group mailing list archive at Nabble.com.
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; netty-users mailing list
&lt;br&gt;&amp;gt; netty-users@lists.jboss.org
&lt;br&gt;&amp;gt; &lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;netty-users mailing list
&lt;br&gt;netty-users@lists.jboss.org
&lt;br&gt;&lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;&lt;/blockquote&gt;
</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/Text-Protocol-Variable-length-variable-number-of-lines-tp3961650p3965964.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3963330"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3963330</id>
	<title>Re: Text Protocol -- Variable length, variable number of lines</title>
	<published>2009-11-06T23:36:38Z</published>
	<updated>2009-11-06T23:36:38Z</updated>
	<author>
		<name>Trustin Lee</name>
	</author>
	<content type="html">Hi Venky,
&lt;br&gt;&lt;br&gt;DelimiterBasedFrameDecoder is perhaps what you are looking for. &amp;nbsp;Also,
&lt;br&gt;please refer to the telnet client/server example.
&lt;br&gt;&lt;br&gt;HTH
&lt;br&gt;&lt;br&gt;— Trustin Lee, &lt;a href=&quot;http://gleamynode.net/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://gleamynode.net/&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;On Sat, Nov 7, 2009 at 7:11 AM, venky10 &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3963330&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Hi,
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I am a newbie to Netty.
&lt;br&gt;&amp;gt; I have text protocol to decode. It has variable number of lines, all
&lt;br&gt;&amp;gt; delimited by 'newline'.
&lt;br&gt;&amp;gt; There is no other end-of-frame delimiter. I am assuming it would be most
&lt;br&gt;&amp;gt; efficient  to read the entire frame till there are no more lines to be read
&lt;br&gt;&amp;gt; on single MessageEvent.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; What is the best approach ?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Thanks,
&lt;br&gt;&amp;gt; Venky
&lt;br&gt;&amp;gt; --
&lt;br&gt;&amp;gt; View this message in context: &lt;a href=&quot;http://n2.nabble.com/Text-Protocol-Variable-length-variable-number-of-lines-tp3961650p3961650.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://n2.nabble.com/Text-Protocol-Variable-length-variable-number-of-lines-tp3961650p3961650.html&lt;/a&gt;&lt;br&gt;&amp;gt; Sent from the Netty User Group mailing list archive at Nabble.com.
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; netty-users mailing list
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3963330&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;/div&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;netty-users mailing list
&lt;br&gt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3963330&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&lt;div class=&quot;signature&quot;&gt;— Trustin Lee, &lt;a href=&quot;http://gleamynode.net/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://gleamynode.net/&lt;/a&gt;&lt;/div&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/Text-Protocol-Variable-length-variable-number-of-lines-tp3961650p3963330.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3961650"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3961650</id>
	<title>Text Protocol -- Variable length, variable number of lines</title>
	<published>2009-11-06T14:11:21Z</published>
	<updated>2009-11-06T14:11:21Z</updated>
	<author>
		<name>venky10</name>
	</author>
	<content type="html">Hi,
&lt;br&gt;&lt;br&gt;I am a newbie to Netty.
&lt;br&gt;I have text protocol to decode. It has variable number of lines, all delimited by 'newline'. 
&lt;br&gt;There is no other end-of-frame delimiter. I am assuming it would be most efficient &amp;nbsp;to read the entire frame till there are no more lines to be read on single MessageEvent.
&lt;br&gt;&lt;br&gt;What is the best approach ?
&lt;br&gt;&lt;br&gt;Thanks,
&lt;br&gt;Venky</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/Text-Protocol-Variable-length-variable-number-of-lines-tp3961650p3961650.html" />
	
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3963624</id>
	<title>RE: Streaming to file</title>
	<published>2009-11-07T02:07:02Z</published>
	<updated>2009-11-07T02:07:02Z</updated>
	<author>
		<name>dhoyt</name>
	</author>
	<content type="html">Thanks Trustin,
&lt;br&gt;&lt;br&gt;That improved the performance a bit. (c: If you get the chance, please take a look at my wget vs. netty message. I could really use some help...
&lt;br&gt;&lt;br&gt;-----Original Message-----
&lt;br&gt;From: &lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3963624&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt; [mailto:&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3963624&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;] On Behalf Of Trustin Lee (???)
&lt;br&gt;Sent: Friday, November 06, 2009 11:36 PM
&lt;br&gt;To: Netty Users
&lt;br&gt;Subject: Re: Streaming to file
&lt;br&gt;&lt;br&gt;Hi David,
&lt;br&gt;&lt;br&gt;ChannelBuffer.getBytes(int index, GatheringByteChannel out, int length)
&lt;br&gt;ChannelBuffer.getBytes(int index, OutputStream out, int length)
&lt;br&gt;ChannelBuffer.readBytes(GatheringByteChannel out, int length)
&lt;br&gt;ChannelBuffer.readBytes(OutputStream out, int length)
&lt;br&gt;&lt;br&gt;are what you are looking for. :)
&lt;br&gt;&lt;br&gt;— Trustin Lee, &lt;a href=&quot;http://*gleamynode.net/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://*gleamynode.net/&lt;/a&gt;&lt;br&gt;&lt;br&gt;On Sat, Nov 7, 2009 at 1:57 AM, Hoyt, David &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3963624&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; What’s the best way to get a ChannelBuffer into a file? I just want to dump
&lt;br&gt;&amp;gt; the incoming bytes into a file.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I’m using NIO and I have a FileChannel and I’m just calling
&lt;br&gt;&amp;gt; &amp;quot;myFileChannel.write(myChannelBuffer.toByteBuffer());
&lt;br&gt;&amp;gt; myFileChannel.flush();&amp;quot; – is that right? Is there a better way?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Is there a way to have my incoming ChannelBuffers automagically be a
&lt;br&gt;&amp;gt; ByteBuffer without having additional overhead of calling .toByteBuffer() and
&lt;br&gt;&amp;gt; risking byte copying?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Thanks,
&lt;br&gt;&amp;gt; - David Hoyt
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; netty-users mailing list
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3963624&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;https://*lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://*lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;/div&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;netty-users mailing list
&lt;br&gt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3963624&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://*lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://*lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;netty-users mailing list
&lt;br&gt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3963624&amp;i=5&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/Streaming-to-file-tp3959961p3963624.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3963328"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3965687</id>
	<title>Re: wget vs netty</title>
	<published>2009-11-07T13:01:57Z</published>
	<updated>2009-11-07T13:01:57Z</updated>
	<author>
		<name>Frederic Bregier</name>
	</author>
	<content type="html">Hi David,
&lt;br&gt;&lt;br&gt;I've got a similar problem using write to file from Java in my project (FTP using Netty).
&lt;br&gt;In fact, it turns out that the problem has nothing related to Netty but of course to JVM way to write files.
&lt;br&gt;&lt;br&gt;To be sure, I've done a little benchmark, trying several ways to read or write files in Java without any network access. 
&lt;br&gt;&lt;br&gt;Here are some results, tested on 2.6.5-7.244-smp 2 cpu 2-core 2.8Ghz Xeon using two JVM: Sun JDK 1.6.0.13 and IBM 1.6 SR5 (5/2009). 
&lt;br&gt;Take them with caution since they must be used for what they are: testing purpose for my scenario
&lt;br&gt;Each wile is written, flushed (by the way available) then delete and rewrited from scratch.
&lt;br&gt;&lt;br&gt;&lt;b&gt;Write file&lt;/b&gt;:
&lt;br&gt;- arbitrary position when write is starting (or restarting)
&lt;br&gt;Note tha FileOutputStream is not allowed since in my scenario we can restart a write from a previous position and FileOutputStream does not allowed to change the position (except 0 or at the end at construction), except if we used the FileChannel with the append mode and the position method of the FileChannel.
&lt;br&gt;&amp;nbsp; &amp;nbsp;- RandomAccessFile : 10 MB files, 10 writes for each thread: 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;1 thread = around 40 MByte/s ; 50 threads = 3,32 MByte/s
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;same but 1 MB files 10 times with 500 threads = &lt;b&gt;2,96&lt;/b&gt;&amp;nbsp;MByte/s (IBM JDK) &lt;b&gt;2.89&lt;/b&gt;&amp;nbsp;MByte/s (SUN JDK)
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp;- FileChannel over a RandomAccessFile : 10 MB files, 10 writes for each thread: 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;1 thread = around 40 MByte/s; 50 threads = 3,33 MByte/s
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;same but 1 MB files 10 times with 500 threads = 2,84 MByte/s (IBM JDK) 2,85 MByte/s (SUN JDK)
&lt;br&gt;&lt;br&gt;Note that most of the time, direct RandomAccessFile is faster than FileChannel for me when more than 100 threads are concurrently writing files.
&lt;br&gt;&lt;br&gt;&lt;br&gt;- start from 0 or from end (append) (FileOutputStream is therefore allowed)
&lt;br&gt;&amp;nbsp; &amp;nbsp;- FileOutputStream : 10 MB files, 10 writes for each thread: 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;1 thread = around 250 MByte/s; 50 threads = 154,5 MByte/s
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;same but 1 MB files 10 times with 500 threads = &lt;b&gt;25,94&lt;/b&gt;&amp;nbsp;MByte/s (IBM JDK) &lt;b&gt;27,42&lt;/b&gt;&amp;nbsp;MByte/s (SUN JDK)
&lt;br&gt;&lt;br&gt;&amp;nbsp; - FileChannel over FileOutputStream : 10 MB files, 10 writes for each thread: 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;1 thread = around 40 MByte/s; 50 threads = 3,15 MByte/s
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;same but 1 MB files 10 times with 500 threads = 2,82 MByte/s (IBM JDK) 2,83 MByte/s (SUN JDK)
&lt;br&gt;&lt;br&gt;&amp;nbsp; - BufferedOutputStream over FileOutputStream : 10 MB files, 10 writes for each thread: 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;1 thread = 250 MByte/s; 50 threads = 183,3 MByte/s
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;same but 1 MB files 10 times with 500 threads = 21,02 MByte/s (IBM JDK) 20,67 MByte/s (SUN JDK)
&lt;br&gt;&lt;br&gt;&lt;br&gt;So FileOutputStream is the faster, Buffered one just under but not FileChannel (same level and even a little bit worst than FileChannel based on RandomAccessFile).
&lt;br&gt;Note that Systems info shows that write speed on disk from system point of view says it was about 3 to 4 MBytes/s whatever the test.
&lt;br&gt;&lt;br&gt;For my project, I need to be sure that I can move from one point to another, so I need RandomAccess capability, so no chance for me to use FileOutputStream directly.
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;b&gt;Read File&lt;/b&gt;: Please note that as each thread access its own file but several times, the system cache is used so the reason of huge performance in reading.
&lt;br&gt;- best is always : FileChannel over a FileInputStream :10 MB files, 10 reads for each thread: 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;1 thread = 2 210 MByte/s; 50 threads = 3 329 MByte/s
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;same but 1 MB files with 500 threads = 2 801 MByte/s (IBM JDK) 3 106 MByte/s (SUN JDK)
&lt;br&gt;&lt;br&gt;I do not show the others, but with many threads, FileChannel over FileInputStream tends to be the best.
&lt;br&gt;&lt;br&gt;&lt;br&gt;Hope this helps others too...
&lt;br&gt;&lt;br&gt;Cheers,
&lt;br&gt;Frederic
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;blockquote class=&quot;quote light-black dark-border-color&quot;&gt;&lt;div class=&quot;quote light-border-color&quot;&gt;
&lt;div class=&quot;quote-author&quot; style=&quot;font-weight: bold;&quot;&gt;Trustin Lee wrote:&lt;/div&gt;
&lt;div class=&quot;quote-message shrinkable-quote&quot;&gt;Hi David,
&lt;br&gt;&lt;br&gt;Just to make sure disk I/O is not a bottleneck, could you try to
&lt;br&gt;configure wget and your Netty application to discard the received data
&lt;br&gt;to /dev/null?
&lt;br&gt;&lt;br&gt;I also wonder if you are using Netty's built-in HTTP codec or your own one.
&lt;br&gt;&lt;br&gt;— Trustin Lee, &lt;a href=&quot;http://gleamynode.net/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://gleamynode.net/&lt;/a&gt;&lt;br&gt;&lt;br&gt;On Sat, Nov 7, 2009 at 7:02 PM, Hoyt, David &amp;lt;hoyt6@llnl.gov&amp;gt; wrote:
&lt;br&gt;&amp;gt; Our application does a lot of downloading -- I notice that when I test my netty app against wget for some basic non-encrypted http streams, wget outperforms my netty app. My basic test is I start 2 wget processes and have them download some content from our server. I then have netty download the same content. I give each 20 seconds to download as much as they can and then I cancel it (the file contents are produced on-the-fly at a constant rate of ~500 KB/s). wget consistently does better than my java app (by ~3MB per file with 2 concurrent downloads). It's a bit confusing, b/c my CPU is nowhere near maxed out using either wget or netty (java). The discrepancy gets much higher when I start doing 10+ concurrent downloads. wget will download an 11 MB file while my java app gets ~700-800 KB. Every message (http chunk) I get from netty is immediately flushed to disk and I'm using a FileChannel for what I figured was optimum performance. It should be able to do the full 11 MB eve!
&lt;br&gt;&amp;gt;  n if it takes a little while for it to come in. 2 streams of 500 KB/s (so ~ 1 MB/s) should be easily handled by java/netty I would think.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I don't think I'm IO-bound - the disk can easily write ~22 MB (the file is ~11 MB) and wget doesn't seem to have a problem writing to disk. I'm on a gigabit line and 22 MB over 20 seconds shouldn't be saturating the connection.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I'm wondering if there's something I'm missing here. I'm following the http examples pretty closely. I use keepAlive, reuseAddress, and tcpNoDelay for the client bootstrap. I made the threads in my thread pool have MAX_PRIORITY to help rule out scheduler issues. Everything else is using the defaults.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I did a quick old IO (OIO) implementation and it seemed to suffer more than netty. I thought perhaps that something I was doing may have cut off the content before it could be flushed to the disk, but using OIO and input streams should have gotten the full content eventually.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I could really use some help or some pointers on what the community does for netty and/or network optimizations.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I'm doing my testing on a Windows box but we'll be deploying for linux. The behavior appears on both platforms (Windows XP and CentOS).
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Thanks,
&lt;br&gt;&amp;gt; - David Hoyt
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; netty-users mailing list
&lt;br&gt;&amp;gt; netty-users@lists.jboss.org
&lt;br&gt;&amp;gt; &lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;netty-users mailing list
&lt;br&gt;netty-users@lists.jboss.org
&lt;br&gt;&lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;&lt;/blockquote&gt;
&lt;div class=&quot;signature&quot;&gt;Hardware/Software Architect&lt;/div&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/Streaming-to-file-tp3959961p3965687.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3964405"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3964405</id>
	<title>Re: wget vs netty</title>
	<published>2009-11-07T06:58:33Z</published>
	<updated>2009-11-07T06:58:33Z</updated>
	<author>
		<name>Trustin Lee</name>
	</author>
	<content type="html">Hi David,
&lt;br&gt;&lt;br&gt;Just to make sure disk I/O is not a bottleneck, could you try to
&lt;br&gt;configure wget and your Netty application to discard the received data
&lt;br&gt;to /dev/null?
&lt;br&gt;&lt;br&gt;I also wonder if you are using Netty's built-in HTTP codec or your own one.
&lt;br&gt;&lt;br&gt;— Trustin Lee, &lt;a href=&quot;http://gleamynode.net/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://gleamynode.net/&lt;/a&gt;&lt;br&gt;&lt;br&gt;On Sat, Nov 7, 2009 at 7:02 PM, Hoyt, David &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3964405&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Our application does a lot of downloading -- I notice that when I test my netty app against wget for some basic non-encrypted http streams, wget outperforms my netty app. My basic test is I start 2 wget processes and have them download some content from our server. I then have netty download the same content. I give each 20 seconds to download as much as they can and then I cancel it (the file contents are produced on-the-fly at a constant rate of ~500 KB/s). wget consistently does better than my java app (by ~3MB per file with 2 concurrent downloads). It's a bit confusing, b/c my CPU is nowhere near maxed out using either wget or netty (java). The discrepancy gets much higher when I start doing 10+ concurrent downloads. wget will download an 11 MB file while my java app gets ~700-800 KB. Every message (http chunk) I get from netty is immediately flushed to disk and I'm using a FileChannel for what I figured was optimum performance. It should be able to do the full 11 MB eve!
&lt;br&gt;&amp;gt;  n if it takes a little while for it to come in. 2 streams of 500 KB/s (so ~ 1 MB/s) should be easily handled by java/netty I would think.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I don't think I'm IO-bound - the disk can easily write ~22 MB (the file is ~11 MB) and wget doesn't seem to have a problem writing to disk. I'm on a gigabit line and 22 MB over 20 seconds shouldn't be saturating the connection.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I'm wondering if there's something I'm missing here. I'm following the http examples pretty closely. I use keepAlive, reuseAddress, and tcpNoDelay for the client bootstrap. I made the threads in my thread pool have MAX_PRIORITY to help rule out scheduler issues. Everything else is using the defaults.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I did a quick old IO (OIO) implementation and it seemed to suffer more than netty. I thought perhaps that something I was doing may have cut off the content before it could be flushed to the disk, but using OIO and input streams should have gotten the full content eventually.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I could really use some help or some pointers on what the community does for netty and/or network optimizations.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I'm doing my testing on a Windows box but we'll be deploying for linux. The behavior appears on both platforms (Windows XP and CentOS).
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Thanks,
&lt;br&gt;&amp;gt; - David Hoyt
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; netty-users mailing list
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3964405&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;/div&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;netty-users mailing list
&lt;br&gt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3964405&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&lt;div class=&quot;signature&quot;&gt;— Trustin Lee, &lt;a href=&quot;http://gleamynode.net/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://gleamynode.net/&lt;/a&gt;&lt;/div&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/Streaming-to-file-tp3959961p3964405.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3963618"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3963618</id>
	<title>wget vs netty</title>
	<published>2009-11-07T02:02:28Z</published>
	<updated>2009-11-07T02:02:28Z</updated>
	<author>
		<name>dhoyt</name>
	</author>
	<content type="html">Our application does a lot of downloading -- I notice that when I test my netty app against wget for some basic non-encrypted http streams, wget outperforms my netty app. My basic test is I start 2 wget processes and have them download some content from our server. I then have netty download the same content. I give each 20 seconds to download as much as they can and then I cancel it (the file contents are produced on-the-fly at a constant rate of ~500 KB/s). wget consistently does better than my java app (by ~3MB per file with 2 concurrent downloads). It's a bit confusing, b/c my CPU is nowhere near maxed out using either wget or netty (java). The discrepancy gets much higher when I start doing 10+ concurrent downloads. wget will download an 11 MB file while my java app gets ~700-800 KB. Every message (http chunk) I get from netty is immediately flushed to disk and I'm using a FileChannel for what I figured was optimum performance. It should be able to do the full 11 MB eve!
&lt;br&gt;&amp;nbsp;n if it takes a little while for it to come in. 2 streams of 500 KB/s (so ~ 1 MB/s) should be easily handled by java/netty I would think. 
&lt;br&gt;&lt;br&gt;I don't think I'm IO-bound - the disk can easily write ~22 MB (the file is ~11 MB) and wget doesn't seem to have a problem writing to disk. I'm on a gigabit line and 22 MB over 20 seconds shouldn't be saturating the connection.
&lt;br&gt;&lt;br&gt;I'm wondering if there's something I'm missing here. I'm following the http examples pretty closely. I use keepAlive, reuseAddress, and tcpNoDelay for the client bootstrap. I made the threads in my thread pool have MAX_PRIORITY to help rule out scheduler issues. Everything else is using the defaults.
&lt;br&gt;&lt;br&gt;I did a quick old IO (OIO) implementation and it seemed to suffer more than netty. I thought perhaps that something I was doing may have cut off the content before it could be flushed to the disk, but using OIO and input streams should have gotten the full content eventually.
&lt;br&gt;&lt;br&gt;I could really use some help or some pointers on what the community does for netty and/or network optimizations.
&lt;br&gt;&lt;br&gt;I'm doing my testing on a Windows box but we'll be deploying for linux. The behavior appears on both platforms (Windows XP and CentOS).
&lt;br&gt;&lt;br&gt;Thanks,
&lt;br&gt;- David Hoyt
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;netty-users mailing list
&lt;br&gt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3963618&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/Streaming-to-file-tp3959961p3963618.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3963328"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3963328</id>
	<title>Re: Streaming to file</title>
	<published>2009-11-06T23:35:35Z</published>
	<updated>2009-11-06T23:35:35Z</updated>
	<author>
		<name>Trustin Lee</name>
	</author>
	<content type="html">Hi David,
&lt;br&gt;&lt;br&gt;ChannelBuffer.getBytes(int index, GatheringByteChannel out, int length)
&lt;br&gt;ChannelBuffer.getBytes(int index, OutputStream out, int length)
&lt;br&gt;ChannelBuffer.readBytes(GatheringByteChannel out, int length)
&lt;br&gt;ChannelBuffer.readBytes(OutputStream out, int length)
&lt;br&gt;&lt;br&gt;are what you are looking for. :)
&lt;br&gt;&lt;br&gt;— Trustin Lee, &lt;a href=&quot;http://gleamynode.net/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://gleamynode.net/&lt;/a&gt;&lt;br&gt;&lt;br&gt;On Sat, Nov 7, 2009 at 1:57 AM, Hoyt, David &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3963328&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; What’s the best way to get a ChannelBuffer into a file? I just want to dump
&lt;br&gt;&amp;gt; the incoming bytes into a file.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I’m using NIO and I have a FileChannel and I’m just calling
&lt;br&gt;&amp;gt; &amp;quot;myFileChannel.write(myChannelBuffer.toByteBuffer());
&lt;br&gt;&amp;gt; myFileChannel.flush();&amp;quot; – is that right? Is there a better way?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Is there a way to have my incoming ChannelBuffers automagically be a
&lt;br&gt;&amp;gt; ByteBuffer without having additional overhead of calling .toByteBuffer() and
&lt;br&gt;&amp;gt; risking byte copying?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Thanks,
&lt;br&gt;&amp;gt; - David Hoyt
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; netty-users mailing list
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3963328&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;/div&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;netty-users mailing list
&lt;br&gt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3963328&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&lt;div class=&quot;signature&quot;&gt;— Trustin Lee, &lt;a href=&quot;http://gleamynode.net/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://gleamynode.net/&lt;/a&gt;&lt;/div&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/Streaming-to-file-tp3959961p3963328.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3959961"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3960409</id>
	<title>Re: Streaming to file</title>
	<published>2009-11-06T10:10:42Z</published>
	<updated>2009-11-06T10:10:42Z</updated>
	<author>
		<name>Mike McGrady</name>
	</author>
	<content type="html">&lt;base href=&quot;x-msg://9/&quot;&gt;This is more than you need but it should help: see at the end of this email. &amp;nbsp;This particular implementation is for decoding a set of files and a management object where each file is sent in chunks. &amp;nbsp;FileChannel is obtained from a FileOutputStream to which the bytes are written, cf. processKarmaFileChunk(...). &amp;nbsp;The file channel is saved until all chunks for a particular file are written. &amp;nbsp;The management object that also was written that has information about where the passed files are is itself passed to an application.&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;AS you can see the ChannelBuffer contains only a byte array that is processed in convertChannelBuffer. &amp;nbsp;Hope this helps.&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Mike&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;P.S. &amp;nbsp;The Karma application is a mobile object as contrasted with a mobile agent application with interfaces that we hope will assist in providing a new IEEE standard that will complement FIPA. &amp;nbsp;We hope to make it public soon and then to begin the IEEE process. &amp;nbsp;Netty is the default transport.&lt;br&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;div&gt;&lt;div&gt;On Nov 6, 2009, at 8:57 AM, Hoyt, David wrote:&lt;/div&gt;&lt;br class=&quot;Apple-interchange-newline&quot;&gt;&lt;blockquote type=&quot;cite&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; &quot;&gt;&lt;div lang=&quot;EN-US&quot; link=&quot;blue&quot; vlink=&quot;purple&quot;&gt;&lt;div class=&quot;Section1&quot;&gt;&lt;div style=&quot;margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 11pt; font-family: Calibri, sans-serif; &quot;&gt;What’s the best way to get a ChannelBuffer into a file? I just want to dump the incoming bytes into a file.&lt;br&gt;&lt;br&gt;I’m using NIO and I have a FileChannel and I’m just calling &quot;myFileChannel.write(myChannelBuffer.toByteBuffer()); myFileChannel.flush();&quot; – is that right? Is there a better way?&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 11pt; font-family: Calibri, sans-serif; &quot;&gt;Is there a way to have my incoming ChannelBuffers automagically be a ByteBuffer without having additional overhead of calling .toByteBuffer() and risking byte copying?&lt;br&gt;&lt;br&gt;Thanks,&lt;br&gt;- David Hoyt&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/div&gt;_______________________________________________&lt;br&gt;netty-users mailing list&lt;br&gt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3960409&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; style=&quot;color: blue; text-decoration: underline; &quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&lt;/div&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; &quot;&gt;&lt;div style=&quot;word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; &quot;&gt;&lt;div style=&quot;word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; &quot;&gt;&lt;div style=&quot;word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; &quot;&gt;&lt;div style=&quot;word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; &quot;&gt;&lt;div style=&quot;word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; &quot;&gt;&lt;div style=&quot;word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; &quot;&gt;&lt;div&gt;Mike McGrady&lt;/div&gt;&lt;div&gt;Principal Investigator AF081-028 AFRL SBIR&lt;/div&gt;&lt;div&gt;Senior Engineer&lt;/div&gt;&lt;div&gt;Topia Technology, Inc.&lt;/div&gt;&lt;div&gt;1.253.720.3365&lt;/div&gt;&lt;div&gt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3960409&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;/div&gt;&lt;/span&gt;&lt;br class=&quot;Apple-interchange-newline&quot;&gt;&lt;/div&gt;&lt;/span&gt;&lt;br class=&quot;Apple-interchange-newline&quot;&gt;&lt;/div&gt;&lt;/span&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;/*&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&amp;nbsp;* KARMA is free software: you can redistribute it and/or modify it under the&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&amp;nbsp;* terms of the GNU LESSER GENERAL PUBLIC LICENSE as published by the Free&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&amp;nbsp;* Software Foundation, either version 3 of the License, or (at your option) any&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&amp;nbsp;* later version. KARMA is distributed in the hope that it will be useful, but&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&amp;nbsp;* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&amp;nbsp;* FITNESS FOR A PARTICULAR PURPOSE. See the GNU LESSER GENERAL PUBLIC LICENSE&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&amp;nbsp;* for more details. You should have received a copy of the GNU LESSER GENERAL&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&amp;nbsp;* PUBLIC LICENSE along with KARMA. If not, see &amp;lt;&lt;a href=&quot;http://www.gnu.org/licenses/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.gnu.org/licenses/&lt;/a&gt;&amp;gt;.&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&amp;nbsp;*/&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #a30069&quot;&gt;package&lt;/span&gt; net.sourceforge.karma.spi.transport.netty;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #a30069&quot;&gt;import&lt;/span&gt; java.io.File;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #a30069&quot;&gt;import&lt;/span&gt; java.io.FileNotFoundException;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #a30069&quot;&gt;import&lt;/span&gt; java.io.FileOutputStream;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #a30069&quot;&gt;import&lt;/span&gt; java.io.IOException;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #a30069&quot;&gt;import&lt;/span&gt; java.nio.ByteBuffer;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #a30069&quot;&gt;import&lt;/span&gt; java.nio.channels.FileChannel;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #a30069&quot;&gt;import&lt;/span&gt; java.security.cert.Certificate;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #a30069&quot;&gt;import&lt;/span&gt; java.util.HashMap;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #a30069&quot;&gt;import&lt;/span&gt; java.util.Map;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #a30069&quot;&gt;import&lt;/span&gt; java.util.UUID;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #a30069&quot;&gt;import&lt;/span&gt; java.util.concurrent.atomic.AtomicInteger;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #a30069&quot;&gt;import&lt;/span&gt; javax.net.ssl.SSLException;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #a30069&quot;&gt;import&lt;/span&gt; javax.net.ssl.SSLPeerUnverifiedException;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #a30069&quot;&gt;import&lt;/span&gt; javax.net.ssl.SSLSession;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #a30069&quot;&gt;import&lt;/span&gt; javax.net.ssl.SSLEngineResult.HandshakeStatus;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #a30069&quot;&gt;import&lt;/span&gt; net.sourceforge.karma.KarmaConstant;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #a30069&quot;&gt;import&lt;/span&gt; net.sourceforge.karma.KarmaManager;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #a30069&quot;&gt;import&lt;/span&gt; net.sourceforge.karma.spi.KarmaReceiver;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #a30069&quot;&gt;import&lt;/span&gt; net.sourceforge.karma.spi.util.KarmaUtility;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #a30069&quot;&gt;import&lt;/span&gt; net.sourceforge.karma.spi.util.NettyKarmaSslHandshake;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #a30069&quot;&gt;import&lt;/span&gt; net.sourceforge.karma.spi.util.StackTrace;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #a30069&quot;&gt;import&lt;/span&gt; org.jboss.netty.buffer.ChannelBuffer;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #a30069&quot;&gt;import&lt;/span&gt; org.jboss.netty.buffer.ChannelBuffers;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #a30069&quot;&gt;import&lt;/span&gt; org.jboss.netty.channel.Channel;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #a30069&quot;&gt;import&lt;/span&gt; org.jboss.netty.channel.ChannelDownstreamHandler;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #a30069&quot;&gt;import&lt;/span&gt; org.jboss.netty.channel.ChannelEvent;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #a30069&quot;&gt;import&lt;/span&gt; org.jboss.netty.channel.ChannelFuture;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #a30069&quot;&gt;import&lt;/span&gt; org.jboss.netty.channel.ChannelFutureListener;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #a30069&quot;&gt;import&lt;/span&gt; org.jboss.netty.channel.ChannelHandlerContext;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #a30069&quot;&gt;import&lt;/span&gt; org.jboss.netty.channel.ChannelPipelineCoverage;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #a30069&quot;&gt;import&lt;/span&gt; org.jboss.netty.channel.ChannelStateEvent;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #a30069&quot;&gt;import&lt;/span&gt; org.jboss.netty.channel.ChannelUpstreamHandler;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #a30069&quot;&gt;import&lt;/span&gt; org.jboss.netty.channel.ChildChannelStateEvent;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #a30069&quot;&gt;import&lt;/span&gt; org.jboss.netty.channel.ExceptionEvent;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #a30069&quot;&gt;import&lt;/span&gt; org.jboss.netty.channel.MessageEvent;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #a30069&quot;&gt;import&lt;/span&gt; org.jboss.netty.channel.SimpleChannelDownstreamHandler;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #a30069&quot;&gt;import&lt;/span&gt; org.jboss.netty.channel.SimpleChannelUpstreamHandler;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #a30069&quot;&gt;import&lt;/span&gt; org.jboss.netty.channel.WriteCompletionEvent;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #a30069&quot;&gt;import&lt;/span&gt; org.jboss.netty.channel.group.ChannelGroup;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #a30069&quot;&gt;import&lt;/span&gt; org.jboss.netty.logging.InternalLogLevel;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #a30069&quot;&gt;import&lt;/span&gt; org.jboss.netty.logging.InternalLogger;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #a30069&quot;&gt;import&lt;/span&gt; org.jboss.netty.logging.InternalLoggerFactory;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;/**&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(147, 144, 176); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #516dcf&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;&amp;lt;p&amp;gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&amp;nbsp;&lt;/span&gt;*&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;A&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;composition&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;(rather&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;than&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;inheritance)&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;a&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;la&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;Joshua&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;Bloch&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;design&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;for&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;the&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;use&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&amp;nbsp;&lt;/span&gt;*&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;of&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;JBoss&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;Netty&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;simple&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;channel&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;upstream&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;and&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;downstream&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;handlers&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;with&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;a&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;KARMA&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&amp;nbsp;&lt;/span&gt;*&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;decoder.&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(147, 144, 176); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #516dcf&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;&amp;lt;/p&amp;gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(147, 144, 176); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #516dcf&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;&amp;lt;p&amp;gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&amp;nbsp;&lt;/span&gt;*&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;The&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;principal&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;method&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;is&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9390b0&quot;&gt;&amp;lt;code&amp;gt;&lt;/span&gt;messageReceivedUpstream&lt;span style=&quot;color: #9390b0&quot;&gt;&amp;lt;/code&amp;gt;&lt;/span&gt;.&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(147, 144, 176); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #516dcf&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;&amp;lt;/p&amp;gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(147, 144, 176); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #516dcf&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;&amp;lt;p&amp;gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&amp;nbsp;&lt;/span&gt;*&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;The&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9390b0&quot;&gt;&amp;lt;code&amp;gt;&lt;/span&gt;KarmaReceiverPipelineFactory&lt;span style=&quot;color: #9390b0&quot;&gt;&amp;lt;/code&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;utilizes&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;this&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;class&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;along&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;with&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&amp;nbsp;&lt;/span&gt;*&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;the&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;standard&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;JBoss&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;Netty&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9390b0&quot;&gt;&amp;lt;code&amp;gt;&lt;/span&gt;SslHandler&lt;span style=&quot;color: #9390b0&quot;&gt;&amp;lt;/code&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;and&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&amp;nbsp;&lt;/span&gt;*&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9390b0&quot;&gt;&amp;lt;code&amp;gt;&lt;/span&gt;SslBufferPool&lt;span style=&quot;color: #9390b0&quot;&gt;&amp;lt;/code&amp;gt;&lt;/span&gt;.&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;Where&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;the&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;event&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;is&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;a&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&amp;nbsp;&lt;/span&gt;*&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9390b0&quot;&gt;&amp;lt;code&amp;gt;&lt;/span&gt;ChannelStateEvent&lt;span style=&quot;color: #9390b0&quot;&gt;&amp;lt;/code&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;and&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;the&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;channel&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;state&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;is&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&amp;nbsp;&lt;/span&gt;*&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9390b0&quot;&gt;&amp;lt;code&amp;gt;&lt;/span&gt;CONNECTED&lt;span style=&quot;color: #9390b0&quot;&gt;&amp;lt;/code&amp;gt;&lt;/span&gt;,&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;the&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9390b0&quot;&gt;&amp;lt;code&amp;gt;&lt;/span&gt;handleUpstream&lt;span style=&quot;color: #9390b0&quot;&gt;&amp;lt;/code&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;method&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;initiates&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;an&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&amp;nbsp;&lt;/span&gt;*&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;handshake&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;with&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;the&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;client&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;on&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;the&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;other&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;end&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;of&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;the&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;channel.&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;The&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&amp;nbsp;&lt;/span&gt;*&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9390b0&quot;&gt;&amp;lt;code&amp;gt;&lt;/span&gt;handshake&lt;span style=&quot;color: #9390b0&quot;&gt;&amp;lt;/code&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;method&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;adds&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;a&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;listener&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;(&lt;span style=&quot;color: #9390b0&quot;&gt;&amp;lt;code&amp;gt;&lt;/span&gt;ConnectionNotice&lt;span style=&quot;color: #9390b0&quot;&gt;&amp;lt;/code&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&amp;nbsp;&lt;/span&gt;*&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;which&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;implements&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9390b0&quot;&gt;&amp;lt;code&amp;gt;&lt;/span&gt;ChannelFutureListener&lt;span style=&quot;color: #9390b0&quot;&gt;&amp;lt;/code&amp;gt;&lt;/span&gt;)&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;to&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;notify&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;the&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;client&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&amp;nbsp;&lt;/span&gt;*&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;when&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;the&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;handshake&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;is&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;successful.&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(147, 144, 176); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #516dcf&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;&amp;lt;/p&amp;gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(147, 144, 176); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #516dcf&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;&amp;lt;p&amp;gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&amp;nbsp;&lt;/span&gt;*&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;All&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9390b0&quot;&gt;&amp;lt;code&amp;gt;&lt;/span&gt;OPEN&lt;span style=&quot;color: #9390b0&quot;&gt;&amp;lt;/code&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;channels&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;are&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;added&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;to&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;the&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;field&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&amp;nbsp;&lt;/span&gt;*&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9390b0&quot;&gt;&amp;lt;code&amp;gt;&lt;/span&gt;allChannels&lt;span style=&quot;color: #9390b0&quot;&gt;&amp;lt;/code&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;to&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;make&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;sure&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;that&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;shutdown&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;is&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;complete&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;and&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&amp;nbsp;&lt;/span&gt;*&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;efficient.&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(147, 144, 176); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #516dcf&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;&amp;lt;p&amp;gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&amp;nbsp;&lt;span style=&quot;color: #516dcf&quot;&gt;*&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&amp;nbsp;&lt;/span&gt;*&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #8baecd&quot;&gt;@author&lt;/span&gt;&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;Mike&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;McGrady&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&amp;nbsp;&lt;/span&gt;*&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #8baecd&quot;&gt;@version&lt;/span&gt;&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;Karma&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;Alpha&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;v001&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&amp;nbsp;&lt;/span&gt;*&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #8baecd&quot;&gt;@since&lt;/span&gt;&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;August&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;2009.&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&amp;nbsp;&lt;/span&gt;*/&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(119, 119, 119); &quot;&gt;@ChannelPipelineCoverage&lt;span style=&quot;color: #000000&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #5c00ff&quot;&gt;&quot;all&quot;&lt;/span&gt;&lt;span style=&quot;color: #000000&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #a30069&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;class&lt;/span&gt; KarmaDecoder &lt;span style=&quot;color: #a30069&quot;&gt;implements&lt;/span&gt; ChannelUpstreamHandler,&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;ChannelDownstreamHandler, Comparable&amp;lt;KarmaDecoder&amp;gt; {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(163, 0, 105); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&lt;/span&gt;private&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;static&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;int&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #3500d1&quot;&gt;managersCount&lt;/span&gt;&lt;span style=&quot;color: #000000&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(163, 0, 105); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&lt;/span&gt;private&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;static&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;int&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #3500d1&quot;&gt;channelCount&lt;/span&gt;&lt;span style=&quot;color: #000000&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;String &lt;span style=&quot;color: #3500d1&quot;&gt;errors&lt;/span&gt;;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; AtomicInteger &lt;span style=&quot;color: #3500d1&quot;&gt;chunkCounter&lt;/span&gt; = &lt;span style=&quot;color: #a30069&quot;&gt;new&lt;/span&gt; AtomicInteger(0);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; InternalLogger &lt;span style=&quot;color: #3500d1&quot;&gt;logger&lt;/span&gt; = InternalLoggerFactory&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;.getInstance(KarmaDecoder.&lt;span style=&quot;color: #a30069&quot;&gt;class&lt;/span&gt;.getName());&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; AtomicInteger &lt;span style=&quot;color: #3500d1&quot;&gt;managerCounter&lt;/span&gt; = &lt;span style=&quot;color: #a30069&quot;&gt;new&lt;/span&gt; AtomicInteger(0);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; AtomicInteger &lt;span style=&quot;color: #3500d1&quot;&gt;readCounter&lt;/span&gt; = &lt;span style=&quot;color: #a30069&quot;&gt;new&lt;/span&gt; AtomicInteger(0);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; ChannelGroup &lt;span style=&quot;color: #3500d1&quot;&gt;allChannels&lt;/span&gt;;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; Map&amp;lt;UUID, Integer&amp;gt; &lt;span style=&quot;color: #3500d1&quot;&gt;fileCount&lt;/span&gt; = &lt;span style=&quot;color: #a30069&quot;&gt;new&lt;/span&gt; HashMap&amp;lt;UUID, Integer&amp;gt;();&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; Map&amp;lt;UUID, FileChannel&amp;gt; &lt;span style=&quot;color: #3500d1&quot;&gt;fileWriters&lt;/span&gt; = &lt;span style=&quot;color: #a30069&quot;&gt;new&lt;/span&gt; HashMap&amp;lt;UUID, FileChannel&amp;gt;();&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; Map&amp;lt;UUID, KarmaManager&amp;gt; &lt;span style=&quot;color: #3500d1&quot;&gt;managers&lt;/span&gt; = &lt;span style=&quot;color: #a30069&quot;&gt;new&lt;/span&gt; HashMap&amp;lt;UUID, KarmaManager&amp;gt;();&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; KarmaReceiver &lt;span style=&quot;color: #3500d1&quot;&gt;receiver&lt;/span&gt;;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; SimpleChannelDownstreamHandler &lt;span style=&quot;color: #3500d1&quot;&gt;scdh&lt;/span&gt; = &lt;span style=&quot;color: #a30069&quot;&gt;new&lt;/span&gt; SimpleChannelDownstreamHandler();&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; SimpleChannelUpstreamHandler &lt;span style=&quot;color: #3500d1&quot;&gt;scuh&lt;/span&gt; = &lt;span style=&quot;color: #a30069&quot;&gt;new&lt;/span&gt; SimpleChannelUpstreamHandler();&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&lt;/span&gt;/**&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;/span&gt;*&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;This&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;listener&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;follows&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;the&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;functionality&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;for&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;the&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;JBoss&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;Netty&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;chat&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;example&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;/span&gt;*&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;for&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;the&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;most&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;part.&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;This&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;is&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;just&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;a&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;standard&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;use&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;of&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;the&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;/span&gt;*&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9390b0&quot;&gt;&amp;lt;code&amp;gt;&lt;/span&gt;ChannelFutureListener&lt;span style=&quot;color: #9390b0&quot;&gt;&amp;lt;/code&amp;gt;&lt;/span&gt;.&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;span style=&quot;color: #516dcf&quot;&gt;*&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;/span&gt;*&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #8baecd&quot;&gt;@author&lt;/span&gt;&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;Mike&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;McGrady&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;span style=&quot;color: #516dcf&quot;&gt;*/&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;class&lt;/span&gt; ConnectionNotice &lt;span style=&quot;color: #a30069&quot;&gt;implements&lt;/span&gt; ChannelFutureListener {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; KarmaSslHandler &lt;span style=&quot;color: #3500d1&quot;&gt;sslHandler&lt;/span&gt;;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;ConnectionNotice(&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; KarmaSslHandler sslHandler) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;sslHandler&lt;/span&gt; = sslHandler;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;void&lt;/span&gt; operationComplete(&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; ChannelFuture future) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;KarmaDecoder.log(InternalLogLevel.&lt;span style=&quot;color: #3500d1&quot;&gt;INFO&lt;/span&gt;, &lt;span style=&quot;color: #5c00ff&quot;&gt;&quot;SslHandler: &quot;&lt;/span&gt; &lt;span style=&quot;color: #279471&quot;&gt;//$NON-NLS-1$&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;					&lt;/span&gt;+ &lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;sslHandler&lt;/span&gt;);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; HandshakeStatus hs = &lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;sslHandler&lt;/span&gt;.getEngine()&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;					&lt;/span&gt;.getHandshakeStatus();&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; SSLSession session = &lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;sslHandler&lt;/span&gt;.getEngine().getSession();&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;KarmaDecoder.log(InternalLogLevel.&lt;span style=&quot;color: #3500d1&quot;&gt;INFO&lt;/span&gt;, &lt;span style=&quot;color: #5c00ff&quot;&gt;&quot;HandshakeStatus: &quot;&lt;/span&gt; + hs); &lt;span style=&quot;color: #279471&quot;&gt;//$NON-NLS-1$&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;KarmaDecoder.log(InternalLogLevel.&lt;span style=&quot;color: #3500d1&quot;&gt;INFO&lt;/span&gt;, &lt;span style=&quot;color: #5c00ff&quot;&gt;&quot;SSLSession: &quot;&lt;/span&gt; + session); &lt;span style=&quot;color: #279471&quot;&gt;//$NON-NLS-1$&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; Certificate[] localCerts = session.getLocalCertificates();&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;Certificate[] peerCerts = &lt;span style=&quot;color: #a30069&quot;&gt;null&lt;/span&gt;;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;try&lt;/span&gt; {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;peerCerts = session.getPeerCertificates();&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;catch&lt;/span&gt; (&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; SSLPeerUnverifiedException e) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;log(&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;						&lt;/span&gt;InternalLogLevel.&lt;span style=&quot;color: #3500d1&quot;&gt;INFO&lt;/span&gt;,&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;						&lt;/span&gt;(KarmaDecoder.&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;errors&lt;/span&gt; = (&lt;span style=&quot;color: #5c00ff&quot;&gt;&quot;\n\t\tERROR MESSAGE: &quot;&lt;/span&gt; &lt;span style=&quot;color: #279471&quot;&gt;//$NON-NLS-1$&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;								&lt;/span&gt;+ e.getMessage() + &lt;span style=&quot;color: #5c00ff&quot;&gt;&quot;\n\t\tERROR STACK TRACE: &quot;&lt;/span&gt; + StackTrace &lt;span style=&quot;color: #279471&quot;&gt;//$NON-NLS-1$&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;								&lt;/span&gt;.trace(e))));&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;for&lt;/span&gt; (&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; Certificate localCert : localCerts) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;log(InternalLogLevel.&lt;span style=&quot;color: #3500d1&quot;&gt;INFO&lt;/span&gt;, &lt;span style=&quot;color: #5c00ff&quot;&gt;&quot;&quot;&lt;/span&gt; + localCert); &lt;span style=&quot;color: #279471&quot;&gt;//$NON-NLS-1$&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (peerCerts != &lt;span style=&quot;color: #a30069&quot;&gt;null&lt;/span&gt;) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;for&lt;/span&gt; (&lt;span style=&quot;color: #a30069&quot;&gt;int&lt;/span&gt; i = 0; i &amp;lt; peerCerts.&lt;span style=&quot;color: #3500d1&quot;&gt;length&lt;/span&gt;; i++) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;					&lt;/span&gt;log(InternalLogLevel.&lt;span style=&quot;color: #3500d1&quot;&gt;INFO&lt;/span&gt;, &lt;span style=&quot;color: #5c00ff&quot;&gt;&quot;&quot;&lt;/span&gt; + localCerts[i]); &lt;span style=&quot;color: #279471&quot;&gt;//$NON-NLS-1$&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (future.isSuccess()) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;byte&lt;/span&gt;[] protectedSession = KarmaUtility&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;						&lt;/span&gt;.toBytes(&lt;span style=&quot;color: #a30069&quot;&gt;new&lt;/span&gt; NettyKarmaSslHandshake(&lt;span style=&quot;color: #a30069&quot;&gt;true&lt;/span&gt;,&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;								&lt;/span&gt;KarmaDecoder.&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;errors&lt;/span&gt;));&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; ChannelBuffer protectedSessionBuf = ChannelBuffers&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;						&lt;/span&gt;.wrappedBuffer(protectedSession);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;future.getChannel().write(protectedSessionBuf);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;else&lt;/span&gt; {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;byte&lt;/span&gt;[] protectedSession = KarmaUtility&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;						&lt;/span&gt;.toBytes(&lt;span style=&quot;color: #a30069&quot;&gt;new&lt;/span&gt; NettyKarmaSslHandshake(&lt;span style=&quot;color: #a30069&quot;&gt;false&lt;/span&gt;,&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;								&lt;/span&gt;KarmaDecoder.&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;errors&lt;/span&gt;));&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; ChannelBuffer protectedSessionBuf = ChannelBuffers&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;						&lt;/span&gt;.wrappedBuffer(protectedSession);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;future.getChannel().write(protectedSessionBuf);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&lt;/span&gt;/**&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;/span&gt;*&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;Creates&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;a&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;new&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;instance&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;with&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;the&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;current&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;system&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;character&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;set.&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;span style=&quot;color: #516dcf&quot;&gt;*/&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;public&lt;/span&gt; KarmaDecoder(&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; KarmaReceiver receiver,&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; ChannelGroup allChannels) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;receiver&lt;/span&gt; = receiver;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;allChannels&lt;/span&gt; = allChannels;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;void&lt;/span&gt; channelOpenUpstream(&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; ChannelHandlerContext ctx,&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; ChannelStateEvent event) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;KarmaDecoder.&lt;span style=&quot;color: #3500d1&quot;&gt;channelCount&lt;/span&gt;++;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;/span&gt;// Add all open channels to the global group so that they are able to be&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;/span&gt;// closed on shutdown.&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; Channel channel = event.getChannel();&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;allChannels&lt;/span&gt;.add(channel);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;ctx.sendUpstream(event);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;int&lt;/span&gt; compareTo(&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; KarmaDecoder decoder) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;int&lt;/span&gt; result = -1;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt; == decoder) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;result = -1;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (decoder == &lt;span style=&quot;color: #a30069&quot;&gt;null&lt;/span&gt;) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;result = -1;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (decoder.hashCode() &amp;gt; &lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.hashCode()) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;result = +1;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (decoder.hashCode() &amp;lt; &lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.hashCode()) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;result = -1;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (decoder.equals(&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;)) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;result = 0;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;else&lt;/span&gt; {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;/span&gt;// Probably impossible.&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;result = -1;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;return&lt;/span&gt; result;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(119, 119, 119); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&lt;/span&gt;@Override&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;boolean&lt;/span&gt; equals(&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; Object obj) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt; == obj) { &lt;span style=&quot;color: #a30069&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;true&lt;/span&gt;; }&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (obj == &lt;span style=&quot;color: #a30069&quot;&gt;null&lt;/span&gt;) { &lt;span style=&quot;color: #a30069&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;false&lt;/span&gt;; }&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (!(obj &lt;span style=&quot;color: #a30069&quot;&gt;instanceof&lt;/span&gt; KarmaDecoder)) { &lt;span style=&quot;color: #a30069&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;false&lt;/span&gt;; }&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; KarmaDecoder other = (KarmaDecoder) obj;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;allChannels&lt;/span&gt; == &lt;span style=&quot;color: #a30069&quot;&gt;null&lt;/span&gt;) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (other.&lt;span style=&quot;color: #3500d1&quot;&gt;allChannels&lt;/span&gt; != &lt;span style=&quot;color: #a30069&quot;&gt;null&lt;/span&gt;) { &lt;span style=&quot;color: #a30069&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;false&lt;/span&gt;; }&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (!&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;allChannels&lt;/span&gt;.equals(other.&lt;span style=&quot;color: #3500d1&quot;&gt;allChannels&lt;/span&gt;)) { &lt;span style=&quot;color: #a30069&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;false&lt;/span&gt;; }&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;fileCount&lt;/span&gt; == &lt;span style=&quot;color: #a30069&quot;&gt;null&lt;/span&gt;) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (other.&lt;span style=&quot;color: #3500d1&quot;&gt;fileCount&lt;/span&gt; != &lt;span style=&quot;color: #a30069&quot;&gt;null&lt;/span&gt;) { &lt;span style=&quot;color: #a30069&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;false&lt;/span&gt;; }&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (!&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;fileCount&lt;/span&gt;.equals(other.&lt;span style=&quot;color: #3500d1&quot;&gt;fileCount&lt;/span&gt;)) { &lt;span style=&quot;color: #a30069&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;false&lt;/span&gt;; }&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;fileWriters&lt;/span&gt; == &lt;span style=&quot;color: #a30069&quot;&gt;null&lt;/span&gt;) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (other.&lt;span style=&quot;color: #3500d1&quot;&gt;fileWriters&lt;/span&gt; != &lt;span style=&quot;color: #a30069&quot;&gt;null&lt;/span&gt;) { &lt;span style=&quot;color: #a30069&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;false&lt;/span&gt;; }&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (!&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;fileWriters&lt;/span&gt;.equals(other.&lt;span style=&quot;color: #3500d1&quot;&gt;fileWriters&lt;/span&gt;)) { &lt;span style=&quot;color: #a30069&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;false&lt;/span&gt;; }&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;managers&lt;/span&gt; == &lt;span style=&quot;color: #a30069&quot;&gt;null&lt;/span&gt;) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (other.&lt;span style=&quot;color: #3500d1&quot;&gt;managers&lt;/span&gt; != &lt;span style=&quot;color: #a30069&quot;&gt;null&lt;/span&gt;) { &lt;span style=&quot;color: #a30069&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;false&lt;/span&gt;; }&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (!&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;managers&lt;/span&gt;.equals(other.&lt;span style=&quot;color: #3500d1&quot;&gt;managers&lt;/span&gt;)) { &lt;span style=&quot;color: #a30069&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;false&lt;/span&gt;; }&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;receiver&lt;/span&gt; == &lt;span style=&quot;color: #a30069&quot;&gt;null&lt;/span&gt;) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (other.&lt;span style=&quot;color: #3500d1&quot;&gt;receiver&lt;/span&gt; != &lt;span style=&quot;color: #a30069&quot;&gt;null&lt;/span&gt;) { &lt;span style=&quot;color: #a30069&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;false&lt;/span&gt;; }&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (!&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;receiver&lt;/span&gt;.equals(other.&lt;span style=&quot;color: #3500d1&quot;&gt;receiver&lt;/span&gt;)) { &lt;span style=&quot;color: #a30069&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;false&lt;/span&gt;; }&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;scdh&lt;/span&gt; == &lt;span style=&quot;color: #a30069&quot;&gt;null&lt;/span&gt;) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (other.&lt;span style=&quot;color: #3500d1&quot;&gt;scdh&lt;/span&gt; != &lt;span style=&quot;color: #a30069&quot;&gt;null&lt;/span&gt;) { &lt;span style=&quot;color: #a30069&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;false&lt;/span&gt;; }&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (!&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;scdh&lt;/span&gt;.equals(other.&lt;span style=&quot;color: #3500d1&quot;&gt;scdh&lt;/span&gt;)) { &lt;span style=&quot;color: #a30069&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;false&lt;/span&gt;; }&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;scuh&lt;/span&gt; == &lt;span style=&quot;color: #a30069&quot;&gt;null&lt;/span&gt;) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (other.&lt;span style=&quot;color: #3500d1&quot;&gt;scuh&lt;/span&gt; != &lt;span style=&quot;color: #a30069&quot;&gt;null&lt;/span&gt;) { &lt;span style=&quot;color: #a30069&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;false&lt;/span&gt;; }&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (!&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;scuh&lt;/span&gt;.equals(other.&lt;span style=&quot;color: #3500d1&quot;&gt;scuh&lt;/span&gt;)) { &lt;span style=&quot;color: #a30069&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;false&lt;/span&gt;; }&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(163, 0, 105); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;/span&gt;return&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;true&lt;span style=&quot;color: #000000&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&lt;/span&gt;/**&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;/span&gt;*&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #8baecd&quot;&gt;@return&lt;/span&gt;&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;the&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;allChannels&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;span style=&quot;color: #516dcf&quot;&gt;*/&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;public&lt;/span&gt; ChannelGroup getAllChannels() {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(53, 0, 209); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #000000&quot;&gt;.&lt;/span&gt;allChannels&lt;span style=&quot;color: #000000&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&lt;/span&gt;/**&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;/span&gt;*&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;{@inheritDoc}&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;Down&lt;span style=&quot;color: #9390b0&quot;&gt;-&lt;/span&gt;casts&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;the&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;received&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;downstream&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;event&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;into&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;more&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;/span&gt;*&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;meaningful&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;sub&lt;span style=&quot;color: #9390b0&quot;&gt;-&lt;/span&gt;type&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;event&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;and&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;calls&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;an&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;appropriate&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;handler&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;method&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;with&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;/span&gt;*&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;the&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;down&lt;span style=&quot;color: #9390b0&quot;&gt;-&lt;/span&gt;casted&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;event.&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;span style=&quot;color: #516dcf&quot;&gt;*/&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;void&lt;/span&gt; handleDownstream(&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; ChannelHandlerContext ctx,&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; ChannelEvent channelEvent) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (channelEvent &lt;span style=&quot;color: #a30069&quot;&gt;instanceof&lt;/span&gt; MessageEvent) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;try&lt;/span&gt; {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;scdh&lt;/span&gt;.writeRequested(ctx, (MessageEvent) channelEvent);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;catch&lt;/span&gt; (&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; Exception e) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;KarmaDecoder.log(InternalLogLevel.&lt;span style=&quot;color: #3500d1&quot;&gt;ERROR&lt;/span&gt;, e.getMessage());&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;e.printStackTrace();&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (channelEvent &lt;span style=&quot;color: #a30069&quot;&gt;instanceof&lt;/span&gt; ChannelStateEvent) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; ChannelStateEvent channelStateEvent = (ChannelStateEvent) channelEvent;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;switch&lt;/span&gt; (channelStateEvent.getState()) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #3500d1&quot;&gt;OPEN&lt;/span&gt;:&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;					&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (!Boolean.&lt;span style=&quot;color: #3500d1&quot;&gt;TRUE&lt;/span&gt;.equals(channelStateEvent.getValue())) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;						&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;try&lt;/span&gt; {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;							&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;scdh&lt;/span&gt;.closeRequested(ctx, channelStateEvent);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;						&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;catch&lt;/span&gt; (&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; Exception e) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;							&lt;/span&gt;KarmaDecoder.log(InternalLogLevel.&lt;span style=&quot;color: #3500d1&quot;&gt;ERROR&lt;/span&gt;, e&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;									&lt;/span&gt;.getMessage());&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;							&lt;/span&gt;e.printStackTrace();&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;						&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;					&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;					&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;break&lt;/span&gt;;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #3500d1&quot;&gt;BOUND&lt;/span&gt;:&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;					&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (channelStateEvent.getValue() != &lt;span style=&quot;color: #a30069&quot;&gt;null&lt;/span&gt;) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;						&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;try&lt;/span&gt; {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;							&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;scdh&lt;/span&gt;.bindRequested(ctx, channelStateEvent);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;						&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;catch&lt;/span&gt; (&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; Exception e) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;							&lt;/span&gt;KarmaDecoder.log(InternalLogLevel.&lt;span style=&quot;color: #3500d1&quot;&gt;ERROR&lt;/span&gt;, e&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;									&lt;/span&gt;.getMessage());&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;							&lt;/span&gt;e.printStackTrace();&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;						&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;					&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;else&lt;/span&gt; {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;						&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;try&lt;/span&gt; {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;							&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;scdh&lt;/span&gt;.unbindRequested(ctx, channelStateEvent);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;						&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;catch&lt;/span&gt; (&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; Exception e) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;							&lt;/span&gt;KarmaDecoder.log(InternalLogLevel.&lt;span style=&quot;color: #3500d1&quot;&gt;ERROR&lt;/span&gt;, e&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;									&lt;/span&gt;.getMessage());&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;							&lt;/span&gt;e.printStackTrace();&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;						&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;					&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;					&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;break&lt;/span&gt;;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(53, 0, 209); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;case&lt;/span&gt;&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;CONNECTED&lt;span style=&quot;color: #000000&quot;&gt;:&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;					&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (channelStateEvent.getValue() != &lt;span style=&quot;color: #a30069&quot;&gt;null&lt;/span&gt;) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;						&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;try&lt;/span&gt; {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;							&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;scdh&lt;/span&gt;.connectRequested(ctx, channelStateEvent);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;						&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;catch&lt;/span&gt; (&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; Exception e) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;							&lt;/span&gt;KarmaDecoder.log(InternalLogLevel.&lt;span style=&quot;color: #3500d1&quot;&gt;ERROR&lt;/span&gt;, e&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;									&lt;/span&gt;.getMessage());&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;							&lt;/span&gt;e.printStackTrace();&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;						&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;					&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;else&lt;/span&gt; {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;						&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;try&lt;/span&gt; {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;							&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;scdh&lt;/span&gt;.disconnectRequested(ctx,&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;									&lt;/span&gt;channelStateEvent);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;						&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;catch&lt;/span&gt; (&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; Exception e) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;							&lt;/span&gt;KarmaDecoder.log(InternalLogLevel.&lt;span style=&quot;color: #3500d1&quot;&gt;ERROR&lt;/span&gt;, e&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;									&lt;/span&gt;.getMessage());&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;							&lt;/span&gt;e.printStackTrace();&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;						&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;					&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;					&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;break&lt;/span&gt;;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(53, 0, 209); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;case&lt;/span&gt;&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;INTEREST_OPS&lt;span style=&quot;color: #000000&quot;&gt;:&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;					&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;try&lt;/span&gt; {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;						&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;scdh&lt;/span&gt;.setInterestOpsRequested(ctx,&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;								&lt;/span&gt;channelStateEvent);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;					&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;catch&lt;/span&gt; (&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; Exception e) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;						&lt;/span&gt;KarmaDecoder&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;								&lt;/span&gt;.log(InternalLogLevel.&lt;span style=&quot;color: #3500d1&quot;&gt;ERROR&lt;/span&gt;, e.getMessage());&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;						&lt;/span&gt;e.printStackTrace();&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;					&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;					&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;break&lt;/span&gt;;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(163, 0, 105); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;&lt;/span&gt;default&lt;span style=&quot;color: #000000&quot;&gt;:&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;					&lt;/span&gt;ctx.sendDownstream(channelEvent);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;else&lt;/span&gt; {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;ctx.sendDownstream(channelEvent);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&lt;/span&gt;/**&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;/span&gt;*&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;Down&lt;span style=&quot;color: #9390b0&quot;&gt;-&lt;/span&gt;casts&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;the&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;received&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;upstream&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;event&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;into&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;more&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;meaningful&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;sub&lt;span style=&quot;color: #9390b0&quot;&gt;-&lt;/span&gt;type&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;/span&gt;*&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;event&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;and&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;calls&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;an&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;appropriate&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;handler&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;method&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;with&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;the&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;down&lt;span style=&quot;color: #9390b0&quot;&gt;-&lt;/span&gt;casted&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;event.&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;span style=&quot;color: #516dcf&quot;&gt;*/&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;void&lt;/span&gt; handleUpstream(&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; ChannelHandlerContext ctx,&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; ChannelEvent channelEvent) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (channelEvent &lt;span style=&quot;color: #a30069&quot;&gt;instanceof&lt;/span&gt; MessageEvent) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.messageReceivedUpstream((MessageEvent) channelEvent);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (channelEvent &lt;span style=&quot;color: #a30069&quot;&gt;instanceof&lt;/span&gt; WriteCompletionEvent) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; WriteCompletionEvent writeCompletionEvent = (WriteCompletionEvent) channelEvent;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;try&lt;/span&gt; {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;scuh&lt;/span&gt;.writeComplete(ctx, writeCompletionEvent);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;catch&lt;/span&gt; (&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; Exception e) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;KarmaDecoder.log(InternalLogLevel.&lt;span style=&quot;color: #3500d1&quot;&gt;ERROR&lt;/span&gt;, e.getMessage());&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;e.printStackTrace();&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (channelEvent &lt;span style=&quot;color: #a30069&quot;&gt;instanceof&lt;/span&gt; ChildChannelStateEvent) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; ChildChannelStateEvent childChannelStateEvent = (ChildChannelStateEvent) channelEvent;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (childChannelStateEvent.getChildChannel().isOpen()) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;try&lt;/span&gt; {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;					&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;scuh&lt;/span&gt;.childChannelOpen(ctx, childChannelStateEvent);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;catch&lt;/span&gt; (&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; Exception e) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;					&lt;/span&gt;KarmaDecoder.log(InternalLogLevel.&lt;span style=&quot;color: #3500d1&quot;&gt;ERROR&lt;/span&gt;, e.getMessage());&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;					&lt;/span&gt;e.printStackTrace();&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;else&lt;/span&gt; {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;try&lt;/span&gt; {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;					&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;scuh&lt;/span&gt;.childChannelClosed(ctx, childChannelStateEvent);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;catch&lt;/span&gt; (&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; Exception e) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;					&lt;/span&gt;KarmaDecoder.log(InternalLogLevel.&lt;span style=&quot;color: #3500d1&quot;&gt;ERROR&lt;/span&gt;, e.getMessage());&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;					&lt;/span&gt;e.printStackTrace();&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (channelEvent &lt;span style=&quot;color: #a30069&quot;&gt;instanceof&lt;/span&gt; ChannelStateEvent) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; ChannelStateEvent channelStateEvent = (ChannelStateEvent) channelEvent;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;switch&lt;/span&gt; (channelStateEvent.getState()) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #3500d1&quot;&gt;OPEN&lt;/span&gt;:&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;					&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (Boolean.&lt;span style=&quot;color: #3500d1&quot;&gt;TRUE&lt;/span&gt;.equals(channelStateEvent.getValue())) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;						&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;try&lt;/span&gt; {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;							&lt;/span&gt;&lt;/span&gt;// Custom coding to make sure that all channels are&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;							&lt;/span&gt;&lt;/span&gt;// added to the channel group.&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;							&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.channelOpenUpstream(ctx, channelStateEvent);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;						&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;catch&lt;/span&gt; (&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; Exception e1) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;							&lt;/span&gt;KarmaDecoder.log(InternalLogLevel.&lt;span style=&quot;color: #3500d1&quot;&gt;ERROR&lt;/span&gt;, e1&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;									&lt;/span&gt;.getMessage());&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;							&lt;/span&gt;e1.printStackTrace();&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;						&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;					&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;else&lt;/span&gt; {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;						&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;try&lt;/span&gt; {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;							&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;scuh&lt;/span&gt;.channelClosed(ctx, channelStateEvent);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;						&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;catch&lt;/span&gt; (&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; Exception e1) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;							&lt;/span&gt;KarmaDecoder.log(InternalLogLevel.&lt;span style=&quot;color: #3500d1&quot;&gt;ERROR&lt;/span&gt;, e1&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;									&lt;/span&gt;.getMessage());&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;							&lt;/span&gt;e1.printStackTrace();&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;						&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;					&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;					&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;break&lt;/span&gt;;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #3500d1&quot;&gt;BOUND&lt;/span&gt;:&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;					&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (channelStateEvent.getValue() != &lt;span style=&quot;color: #a30069&quot;&gt;null&lt;/span&gt;) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;						&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;try&lt;/span&gt; {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;							&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;scuh&lt;/span&gt;.channelBound(ctx, channelStateEvent);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;						&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;catch&lt;/span&gt; (&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; Exception e) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;							&lt;/span&gt;KarmaDecoder.log(InternalLogLevel.&lt;span style=&quot;color: #3500d1&quot;&gt;ERROR&lt;/span&gt;, e&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;									&lt;/span&gt;.getMessage());&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;							&lt;/span&gt;e.printStackTrace();&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;						&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;					&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;else&lt;/span&gt; {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;						&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;try&lt;/span&gt; {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;							&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;scuh&lt;/span&gt;.channelUnbound(ctx, channelStateEvent);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;						&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;catch&lt;/span&gt; (&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; Exception e) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;							&lt;/span&gt;KarmaDecoder.log(InternalLogLevel.&lt;span style=&quot;color: #3500d1&quot;&gt;ERROR&lt;/span&gt;, e&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;									&lt;/span&gt;.getMessage());&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;							&lt;/span&gt;e.printStackTrace();&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;						&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;					&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;					&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;break&lt;/span&gt;;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(53, 0, 209); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;case&lt;/span&gt;&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;CONNECTED&lt;span style=&quot;color: #000000&quot;&gt;:&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;					&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (channelStateEvent.getValue() != &lt;span style=&quot;color: #a30069&quot;&gt;null&lt;/span&gt;) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;						&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;try&lt;/span&gt; {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;							&lt;/span&gt;&lt;/span&gt;// Custom coding to make sure that the exchanges are&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;							&lt;/span&gt;&lt;/span&gt;// appropriate encrypted with PKI.&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;							&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.handshake(ctx, channelStateEvent);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;						&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;catch&lt;/span&gt; (&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; Exception e) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;							&lt;/span&gt;KarmaDecoder.log(InternalLogLevel.&lt;span style=&quot;color: #3500d1&quot;&gt;ERROR&lt;/span&gt;, e&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;									&lt;/span&gt;.getMessage());&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;							&lt;/span&gt;e.printStackTrace();&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;						&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;					&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;else&lt;/span&gt; {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;						&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;try&lt;/span&gt; {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;							&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;scuh&lt;/span&gt;.channelDisconnected(ctx,&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;									&lt;/span&gt;channelStateEvent);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;						&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;catch&lt;/span&gt; (&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; Exception e) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;							&lt;/span&gt;KarmaDecoder.log(InternalLogLevel.&lt;span style=&quot;color: #3500d1&quot;&gt;ERROR&lt;/span&gt;, e&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;									&lt;/span&gt;.getMessage());&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;							&lt;/span&gt;e.printStackTrace();&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;						&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;					&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;					&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;break&lt;/span&gt;;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(53, 0, 209); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;case&lt;/span&gt;&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;INTEREST_OPS&lt;span style=&quot;color: #000000&quot;&gt;:&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;					&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;try&lt;/span&gt; {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;						&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;scuh&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;								&lt;/span&gt;.channelInterestChanged(ctx, channelStateEvent);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;					&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;catch&lt;/span&gt; (&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; Exception e) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;						&lt;/span&gt;KarmaDecoder&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;								&lt;/span&gt;.log(InternalLogLevel.&lt;span style=&quot;color: #3500d1&quot;&gt;ERROR&lt;/span&gt;, e.getMessage());&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;						&lt;/span&gt;e.printStackTrace();&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;					&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;					&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;break&lt;/span&gt;;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(163, 0, 105); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;&lt;/span&gt;default&lt;span style=&quot;color: #000000&quot;&gt;:&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;					&lt;/span&gt;ctx.sendUpstream(channelEvent);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (channelEvent &lt;span style=&quot;color: #a30069&quot;&gt;instanceof&lt;/span&gt; ExceptionEvent) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;try&lt;/span&gt; {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;scuh&lt;/span&gt;.exceptionCaught(ctx, (ExceptionEvent) channelEvent);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;catch&lt;/span&gt; (&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; Exception e) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;KarmaDecoder.log(InternalLogLevel.&lt;span style=&quot;color: #3500d1&quot;&gt;ERROR&lt;/span&gt;, e.getMessage());&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;e.printStackTrace();&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;else&lt;/span&gt; {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;ctx.sendUpstream(channelEvent);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(119, 119, 119); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&lt;/span&gt;@Override&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;int&lt;/span&gt; hashCode() {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;int&lt;/span&gt; prime = 31;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;int&lt;/span&gt; result = 1;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;result = prime&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;* result&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;+ ((&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;allChannels&lt;/span&gt; == &lt;span style=&quot;color: #a30069&quot;&gt;null&lt;/span&gt;) ? 0 : &lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;allChannels&lt;/span&gt;.hashCode());&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;result = prime * result&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;+ ((&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;fileCount&lt;/span&gt; == &lt;span style=&quot;color: #a30069&quot;&gt;null&lt;/span&gt;) ? 0 : &lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;fileCount&lt;/span&gt;.hashCode());&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;result = prime&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;* result&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;+ ((&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;fileWriters&lt;/span&gt; == &lt;span style=&quot;color: #a30069&quot;&gt;null&lt;/span&gt;) ? 0 : &lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;fileWriters&lt;/span&gt;.hashCode());&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;result = prime * result&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;+ ((&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;managers&lt;/span&gt; == &lt;span style=&quot;color: #a30069&quot;&gt;null&lt;/span&gt;) ? 0 : &lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;managers&lt;/span&gt;.hashCode());&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;result = prime * result&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;+ ((&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;receiver&lt;/span&gt; == &lt;span style=&quot;color: #a30069&quot;&gt;null&lt;/span&gt;) ? 0 : &lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;receiver&lt;/span&gt;.hashCode());&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;result = prime * result&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;+ ((&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;scdh&lt;/span&gt; == &lt;span style=&quot;color: #a30069&quot;&gt;null&lt;/span&gt;) ? 0 : &lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;scdh&lt;/span&gt;.hashCode());&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;result = prime * result&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;+ ((&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;scuh&lt;/span&gt; == &lt;span style=&quot;color: #a30069&quot;&gt;null&lt;/span&gt;) ? 0 : &lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;scuh&lt;/span&gt;.hashCode());&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;return&lt;/span&gt; result;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&lt;/span&gt;/**&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;/span&gt;*&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #8baecd&quot;&gt;@param&lt;/span&gt;&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;messageBuffer&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(139, 174, 205); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;/span&gt;&lt;span style=&quot;color: #516dcf&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;@return&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;span style=&quot;color: #516dcf&quot;&gt;*/&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;private&lt;/span&gt; Object convertChannelBuffer(&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; ChannelBuffer messageBuffer) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;int&lt;/span&gt; readableBytes = messageBuffer.readableBytes();&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;byte&lt;/span&gt;[] readBytes = &lt;span style=&quot;color: #a30069&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;byte&lt;/span&gt;[readableBytes];&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;messageBuffer.readBytes(readBytes);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; Object object = KarmaUtility.toObject(readBytes);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;return&lt;/span&gt; object;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;void&lt;/span&gt; decode(&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; Channel channel, &lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; Object msg) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; ChannelBuffer msgBuf = (ChannelBuffer) msg;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #279471&quot;&gt;/*&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt; * Converts the channel buffer bytes to an object.&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt; */&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; Object object = &lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.convertChannelBuffer(msgBuf);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #279471&quot;&gt;/*&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt; * Keeps track of how many managers and how many file stream chunks have&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt; * been processed. This envisions future additions to functionality.&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt; */&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (object &lt;span style=&quot;color: #a30069&quot;&gt;instanceof&lt;/span&gt; KarmaManager) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;KarmaDecoder.&lt;span style=&quot;color: #3500d1&quot;&gt;managerCounter&lt;/span&gt;.incrementAndGet();&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (object &lt;span style=&quot;color: #a30069&quot;&gt;instanceof&lt;/span&gt; KarmaChunk) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;KarmaDecoder.&lt;span style=&quot;color: #3500d1&quot;&gt;chunkCounter&lt;/span&gt;.incrementAndGet();&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #279471&quot;&gt;/*&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt; * Uses different methods to process KarmaChunks versus KarmaManagers.&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt; */&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (object &lt;span style=&quot;color: #a30069&quot;&gt;instanceof&lt;/span&gt; KarmaChunk) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #279471&quot;&gt;/*&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt; * Chunk processing.&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt; */&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; KarmaChunk chunk = (KarmaChunk) object;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.processKarmaFileChunk(channel, chunk);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (object &lt;span style=&quot;color: #a30069&quot;&gt;instanceof&lt;/span&gt; KarmaManager) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #279471&quot;&gt;/*&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt; * Manager processing.&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt; */&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; KarmaManager manager = (KarmaManager) object;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.processKarmaManager(manager);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;else&lt;/span&gt; {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #279471&quot;&gt;/*&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt; * This should never happen. &lt;span style=&quot;color: #8baecd&quot;&gt;TODO&lt;/span&gt; - get a more sophisticated&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt; * response to this unwanted alternative.&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt; */&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;KarmaDecoder.log(InternalLogLevel.&lt;span style=&quot;color: #3500d1&quot;&gt;ERROR&lt;/span&gt;,&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(92, 0, 255); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;					&lt;/span&gt;&lt;/span&gt;&quot;Not a legimate object type.&quot;&lt;span style=&quot;color: #000000&quot;&gt;); &lt;/span&gt;&lt;span style=&quot;color: #279471&quot;&gt;//$NON-NLS-1$&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&lt;/span&gt;/**&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;/span&gt;*&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;Invoked&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;when&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;a&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5e44cf&quot;&gt;{@link Channel}&lt;/span&gt;&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;is&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;open,&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;bound&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;to&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;a&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;local&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;address,&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;and&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;/span&gt;*&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;connected&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;to&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;a&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;remote&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;address.&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;span style=&quot;color: #516dcf&quot;&gt;*/&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;void&lt;/span&gt; handshake(&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; ChannelHandlerContext ctx,&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; ChannelStateEvent evnet) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;/span&gt;// Get the SslHandler in the current pipeline.&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;/span&gt;// We added it in SecureChatPipelineFactory.&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; KarmaSslHandler sslHandler = ctx.getPipeline().get(&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;KarmaSslHandler.&lt;span style=&quot;color: #a30069&quot;&gt;class&lt;/span&gt;);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;/span&gt;// Get notified when SSL handshake is done.&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;ChannelFuture handshakeFuture = &lt;span style=&quot;color: #a30069&quot;&gt;null&lt;/span&gt;;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;try&lt;/span&gt; {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;handshakeFuture = sslHandler.handshake(evnet.getChannel());&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;catch&lt;/span&gt; (&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; SSLException e) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;KarmaDecoder.log(InternalLogLevel.&lt;span style=&quot;color: #3500d1&quot;&gt;ERROR&lt;/span&gt;, (&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;errors&lt;/span&gt; = e&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;					&lt;/span&gt;.getMessage()));&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;handshakeFuture.addListener(&lt;span style=&quot;color: #a30069&quot;&gt;new&lt;/span&gt; ConnectionNotice(sslHandler));&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&lt;/span&gt;/**&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;/span&gt;*&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;Invoked&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;when&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;a&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;message&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;object&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;(e.g:&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5e44cf&quot;&gt;{@link ChannelBuffer}&lt;/span&gt;)&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;was&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;received&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;/span&gt;*&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;from&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;a&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;remote&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;peer.&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;span style=&quot;color: #516dcf&quot;&gt;*/&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;void&lt;/span&gt; messageReceivedUpstream(&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; MessageEvent event) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;KarmaDecoder.&lt;span style=&quot;color: #3500d1&quot;&gt;readCounter&lt;/span&gt;.incrementAndGet();&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; Object originalMessage = event.getMessage();&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.decode(event.getChannel(), originalMessage);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&lt;/span&gt;/**&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;span style=&quot;color: #516dcf&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: #9390b0&quot;&gt;&amp;lt;p&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;/span&gt;*&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;This&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;method&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;processes&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;data&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;stream&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;file&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;chunks.&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;A&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;file&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;output&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;stream&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;is&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;/span&gt;*&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;created&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;that&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;has&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;the&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;appropriate&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;location&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;in&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;~/.KARMA/.AUM.&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;A&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;Java&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;NIO&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;/span&gt;*&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;file&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;channel&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;is&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;obtained&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;fromt&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;he&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;file&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;output&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;stream&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;and&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;is&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;saved&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;under&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;/span&gt;*&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;the&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;chunk's&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9390b0&quot;&gt;&amp;lt;code&amp;gt;&lt;/span&gt;UUID&lt;span style=&quot;color: #9390b0&quot;&gt;&amp;lt;/code&amp;gt;&lt;/span&gt;,&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;which&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;is&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;also&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;the&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;ID&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;of&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;the&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;manager&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;in&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;the&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;/span&gt;*&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9390b0&quot;&gt;&amp;lt;code&amp;gt;&lt;/span&gt;fileWriters&lt;span style=&quot;color: #9390b0&quot;&gt;&amp;lt;/code&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9390b0&quot;&gt;&amp;lt;code&amp;gt;&lt;/span&gt;Map&lt;span style=&quot;color: #9390b0&quot;&gt;&amp;lt;/code&amp;gt;&lt;/span&gt;.&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;N.B.:&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;this&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;assumes&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;that&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;the&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;/span&gt;*&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;chunks&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;will&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;arrive&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;in&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;order.&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(147, 144, 176); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;/span&gt;&lt;span style=&quot;color: #516dcf&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;&amp;lt;/p&amp;gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;span style=&quot;color: #516dcf&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: #9390b0&quot;&gt;&amp;lt;p&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;/span&gt;*&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;Eventually&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;we&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;should&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;not&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;assume&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;that&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;the&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;chunks&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;arrive&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;in&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;order&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;and&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;/span&gt;*&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;should&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;write&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;them&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;according&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;to&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;a&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;given&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;logic.&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;This&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;will&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;allow&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;us&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;to&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;take&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;/span&gt;*&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;care&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;of&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;divergent&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;delivery&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;scenarios.&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(147, 144, 176); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;/span&gt;&lt;span style=&quot;color: #516dcf&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;&amp;lt;/p&amp;gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;span style=&quot;color: #516dcf&quot;&gt;*&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;/span&gt;*&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #8baecd&quot;&gt;@param&lt;/span&gt;&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;channel&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(139, 174, 205); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;/span&gt;&lt;span style=&quot;color: #516dcf&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;@param&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #516dcf&quot;&gt;chunk&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;span style=&quot;color: #516dcf&quot;&gt;*/&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;void&lt;/span&gt; processKarmaFileChunk(&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; Channel channel,&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; KarmaChunk chunk) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;byte&lt;/span&gt;[] chunkBytes = chunk.&lt;span style=&quot;color: #3500d1&quot;&gt;bytes&lt;/span&gt;;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #279471&quot;&gt;/*&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt; * When the first file chunk arrives, create the file channel from the&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt; * file output stream for later use.&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt; */&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (chunk.&lt;span style=&quot;color: #3500d1&quot;&gt;id&lt;/span&gt; == 1) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; String baseName = KarmaConstant.&lt;span style=&quot;color: #3500d1&quot;&gt;AUM&lt;/span&gt; + chunk.&lt;span style=&quot;color: #3500d1&quot;&gt;uuid&lt;/span&gt;;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; File chunkFile = &lt;span style=&quot;color: #a30069&quot;&gt;new&lt;/span&gt; File(baseName);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (!chunkFile.exists()) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;chunkFile.mkdirs();&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;chunkFile.isDirectory();&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; String toFileName = baseName + File.&lt;span style=&quot;color: #3500d1&quot;&gt;separatorChar&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;					&lt;/span&gt;+ chunk.&lt;span style=&quot;color: #3500d1&quot;&gt;fileName&lt;/span&gt;;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;FileChannel fileChannel = &lt;span style=&quot;color: #a30069&quot;&gt;null&lt;/span&gt;;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;try&lt;/span&gt; {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;fileChannel = &lt;span style=&quot;color: #a30069&quot;&gt;new&lt;/span&gt; FileOutputStream(toFileName).getChannel();&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;catch&lt;/span&gt; (&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; FileNotFoundException e) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;KarmaDecoder.log(InternalLogLevel.&lt;span style=&quot;color: #3500d1&quot;&gt;ERROR&lt;/span&gt;, e.getMessage());&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;fileWriters&lt;/span&gt;.put(chunk.&lt;span style=&quot;color: #3500d1&quot;&gt;uuid&lt;/span&gt;, fileChannel);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #279471&quot;&gt;/*&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt; * For all chunks, put the bytes into a pre-allocated byte buffer, flip&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt; * and write.&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt; */&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; ByteBuffer buffer = ByteBuffer.allocate(chunkBytes.&lt;span style=&quot;color: #3500d1&quot;&gt;length&lt;/span&gt;);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;buffer.put(chunkBytes);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;buffer.flip();&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;try&lt;/span&gt; {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;fileWriters&lt;/span&gt;.get(chunk.&lt;span style=&quot;color: #3500d1&quot;&gt;uuid&lt;/span&gt;).write(buffer);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #279471&quot;&gt;/*&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt; * When the chunk contains the end of the file, remove the file&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt; * channel after writing and close it. This is sort of an&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt; * independent check.&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt; */&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (chunk.&lt;span style=&quot;color: #3500d1&quot;&gt;fileLength&lt;/span&gt; == chunk.&lt;span style=&quot;color: #3500d1&quot;&gt;offset&lt;/span&gt;) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; FileChannel fileChannel = &lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;fileWriters&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;						&lt;/span&gt;.remove(chunk.&lt;span style=&quot;color: #3500d1&quot;&gt;uuid&lt;/span&gt;);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;fileChannel.close();&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;catch&lt;/span&gt; (&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; IOException e) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;KarmaDecoder.log(InternalLogLevel.&lt;span style=&quot;color: #3500d1&quot;&gt;ERROR&lt;/span&gt;, e.getMessage());&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (chunk.&lt;span style=&quot;color: #3500d1&quot;&gt;isLast&lt;/span&gt;) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; Integer fileNumber = &lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;fileCount&lt;/span&gt;.get(chunk.&lt;span style=&quot;color: #3500d1&quot;&gt;uuid&lt;/span&gt;);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #279471&quot;&gt;/*&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt; * This value is NOT otiose. It should be kept. When the value is&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt; * the first and last it does not get to be incremented.&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt; */&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; (fileNumber == &lt;span style=&quot;color: #a30069&quot;&gt;null&lt;/span&gt;) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;fileCount&lt;/span&gt;.put(chunk.&lt;span style=&quot;color: #3500d1&quot;&gt;uuid&lt;/span&gt;, &lt;span style=&quot;color: #a30069&quot;&gt;new&lt;/span&gt; Integer(1));&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; Integer numberOfFiles = &lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;fileCount&lt;/span&gt;.get(chunk.&lt;span style=&quot;color: #3500d1&quot;&gt;uuid&lt;/span&gt;);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #279471&quot;&gt;/*&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt; * Note that is NOT the number of CHUNKS but the number of FILES.&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt; */&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;int&lt;/span&gt; numberOfFilesReceived = numberOfFiles.intValue();&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; KarmaManager manager = &lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;managers&lt;/span&gt;.get(chunk.&lt;span style=&quot;color: #3500d1&quot;&gt;uuid&lt;/span&gt;);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;int&lt;/span&gt; numberOfManagerFileNames = manager.getResources().size();&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #279471&quot;&gt;/*&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt; * We have now got all CHUNKS and all FILES.&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt; */&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;if&lt;/span&gt; ((numberOfManagerFileNames == numberOfFilesReceived)&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;					&lt;/span&gt;&amp;amp;&amp;amp; (&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;managers&lt;/span&gt;.get(chunk.&lt;span style=&quot;color: #3500d1&quot;&gt;uuid&lt;/span&gt;) != &lt;span style=&quot;color: #a30069&quot;&gt;null&lt;/span&gt;)) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #279471&quot;&gt;/*&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt; * If all the chunks have arrived.&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt; */&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;managers&lt;/span&gt;.remove(chunk.&lt;span style=&quot;color: #3500d1&quot;&gt;uuid&lt;/span&gt;);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;fileCount&lt;/span&gt;.remove(chunk.&lt;span style=&quot;color: #3500d1&quot;&gt;uuid&lt;/span&gt;);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;fileWriters&lt;/span&gt;.remove(chunk.&lt;span style=&quot;color: #3500d1&quot;&gt;uuid&lt;/span&gt;);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #279471&quot;&gt;/*&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt; * This is the end of the road for this transmission. At this&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt; * point all the files and the manager have been received and&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt; * the chunks have been written to the file by the file channel.&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt; * The manager will now be sent to the application with all the&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt; * requisite information to get to the file resources and to do&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt; * whatever the application likes.&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt; */&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;receiver&lt;/span&gt;.update(manager);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;} &lt;span style=&quot;color: #a30069&quot;&gt;else&lt;/span&gt; {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #279471&quot;&gt;/*&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt; * Keep track of how many FILES have arrived.&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(39, 148, 113); &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt; */&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;numberOfFilesReceived++;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;fileCount&lt;/span&gt;.put(chunk.&lt;span style=&quot;color: #3500d1&quot;&gt;uuid&lt;/span&gt;, &lt;span style=&quot;color: #a30069&quot;&gt;new&lt;/span&gt; Integer(&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;						&lt;/span&gt;numberOfFilesReceived));&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;buffer.clear();&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&lt;/span&gt;/**&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;span style=&quot;color: #516dcf&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: #9390b0&quot;&gt;&amp;lt;p&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;/span&gt;*&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;This&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;method&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;processes&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;the&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;manager&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;objects.&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(147, 144, 176); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;/span&gt;&lt;span style=&quot;color: #516dcf&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;&amp;lt;/p&amp;gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;span style=&quot;color: #516dcf&quot;&gt;*&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(81, 109, 207); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;/span&gt;*&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #8baecd&quot;&gt;@param&lt;/span&gt;&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;manager&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; &lt;span style=&quot;color: #516dcf&quot;&gt;*/&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;void&lt;/span&gt; processKarmaManager(&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; KarmaManager manager) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(53, 0, 209); &quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;/span&gt;managersCount&lt;span style=&quot;color: #000000&quot;&gt;++;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;final&lt;/span&gt; UUID uuid = manager.getId();&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #3500d1&quot;&gt;managers&lt;/span&gt;.put(uuid, manager);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #a30069&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #a30069&quot;&gt;void&lt;/span&gt; log(InternalLogLevel level, String msg) {&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #3500d1&quot;&gt;logger&lt;/span&gt;.log(level, msg);&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;}&lt;/div&gt;&lt;div&gt;&lt;font class=&quot;Apple-style-span&quot; face=&quot;Monaco&quot; size=&quot;3&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 11px;&quot;&gt;&lt;br&gt;&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;&lt;/div&gt;&lt;/span&gt;&lt;br class=&quot;Apple-interchange-newline&quot;&gt;&lt;/div&gt;&lt;/span&gt;&lt;br class=&quot;Apple-interchange-newline&quot;&gt;&lt;/div&gt;&lt;/span&gt;&lt;br class=&quot;Apple-interchange-newline&quot;&gt;&lt;/span&gt;&lt;br class=&quot;Apple-interchange-newline&quot;&gt;
&lt;/div&gt;
&lt;br&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;_______________________________________________
&lt;br&gt;netty-users mailing list
&lt;br&gt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3960409&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/Streaming-to-file-tp3959961p3960409.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3959961"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3959961</id>
	<title>Streaming to file</title>
	<published>2009-11-06T08:57:47Z</published>
	<updated>2009-11-06T08:57:47Z</updated>
	<author>
		<name>dhoyt</name>
	</author>
	<content type="html">


&lt;meta http-equiv=Content-Type content=&quot;text/html; charset=us-ascii&quot;&gt;
&lt;meta name=Generator content=&quot;Microsoft Word 12 (filtered medium)&quot;&gt;

&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;o:shapedefaults v:ext=&quot;edit&quot; spidmax=&quot;1026&quot; /&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;o:shapelayout v:ext=&quot;edit&quot;&gt;
  &lt;o:idmap v:ext=&quot;edit&quot; data=&quot;1&quot; /&gt;
 &lt;/o:shapelayout&gt;&lt;/xml&gt;&lt;![endif]--&gt;




&lt;div class=Section1&gt;

&lt;p class=MsoNormal&gt;What&amp;#8217;s the best way to get a ChannelBuffer into a
file? I just want to dump the incoming bytes into a file.&lt;br&gt;
&lt;br&gt;
I&amp;#8217;m using NIO and I have a FileChannel and I&amp;#8217;m just calling &amp;quot;myFileChannel.write(myChannelBuffer.toByteBuffer());
myFileChannel.flush();&amp;quot; &amp;#8211; is that right? Is there a better way? &lt;br&gt;
&lt;br&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;Is there a way to have my incoming ChannelBuffers
automagically be a ByteBuffer without having additional overhead of calling
.toByteBuffer() and risking byte copying?&lt;br&gt;
&lt;br&gt;
Thanks,&lt;br&gt;
- David Hoyt&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;/div&gt;




&lt;br /&gt;_______________________________________________
&lt;br&gt;netty-users mailing list
&lt;br&gt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3959961&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/Streaming-to-file-tp3959961p3959961.html" />
	
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3955402</id>
	<title>Http server Session/Context management when server has Netty NIO backend</title>
	<published>2009-11-05T14:08:53Z</published>
	<updated>2009-11-05T14:08:53Z</updated>
	<author>
		<name>rajks</name>
	</author>
	<content type="html">Hi,
&lt;br&gt;&lt;br&gt;Appreciate if anybody can guide me in what I what to achieve with Netty Http server.
&lt;br&gt;&lt;br&gt;The http server is more like a proxy but not a real proxy. When a request comes in I need to talk to at least two backend servers and I was planning to use Netty NIO client.
&lt;br&gt;&lt;br&gt;1. My question is how do I maintain session/context management in such a scenario and handle events correctly. &amp;nbsp;The stack with the server pipeline and 2 backend client pipelines end handlers
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;NIO Server
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Server-RequstHandler
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (context object)
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;NIO client &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;NIO Client
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Backend1-Handler &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Backend2-handler
&lt;br&gt;&lt;br&gt;As I need to maintain states/context when doing the backend I was thinking of a single context object per request with various methods like onServerMessage recd, onBackend1MessageRecd and more like this to keep states/contexts to handle. I am also planning to use OMAthreads also in all 3 pipelines.
&lt;br&gt;&lt;br&gt;2. I would need to send response back to client in a async way by using the writeComplete event in the Server-RequestHandler.
&lt;br&gt;&lt;br&gt;How can I achieve this using the various handler models. I saw the proxy example but could not find a session/context management example.
&lt;br&gt;&lt;br&gt;Any help appreciated.
&lt;br&gt;&lt;br&gt;Thanks
&lt;br&gt;Raj</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/Http-server-Session-Context-management-when-server-has-Netty-NIO-backend-tp3955402p3955402.html" />
	
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3965218</id>
	<title>Re: HashedWheelTimer is leaking threads, am I doing something wrong?</title>
	<published>2009-11-07T10:32:09Z</published>
	<updated>2009-11-07T10:32:09Z</updated>
	<author>
		<name>Garry Watkins</name>
	</author>
	<content type="html">When the timeout occurs, how does it run the timeouthandler? &amp;nbsp;Does it &amp;nbsp;
&lt;br&gt;do it from a thread pool, or does it run on the hashedWheelTimer's &amp;nbsp;
&lt;br&gt;thread?
&lt;br&gt;&lt;br&gt;Another quick question. &amp;nbsp;I am writing a piece of PLC Communications &amp;nbsp;
&lt;br&gt;software based on a request and response cycle, and I have one handler &amp;nbsp;
&lt;br&gt;that needs to act as a codec because it needs to maintain state &amp;nbsp;
&lt;br&gt;between the request and response.
&lt;br&gt;&lt;br&gt;My setup is like this
&lt;br&gt;&lt;br&gt;PLC device =&amp;gt; (upstream starts) LengthBasedFramer =&amp;gt; TCPFrameCODEC &amp;nbsp;
&lt;br&gt;(checks to see if response.transid = &amp;nbsp;lastRequest.transid) = &amp;gt; &amp;nbsp;
&lt;br&gt;BusinessLogicHandler (downstream starts) =&amp;gt; TCPFrameCodec (increment &amp;nbsp;
&lt;br&gt;lastRequest.transid) =&amp;gt; PLC device
&lt;br&gt;&lt;br&gt;Is this the best way to do this?
&lt;br&gt;&lt;br&gt;Thanks
&lt;br&gt;&lt;br&gt;Garry Watkins
&lt;br&gt;&lt;br&gt;Managing Director
&lt;br&gt;DynaFOCUS, LLC
&lt;br&gt;1097 Rivershore Rd.
&lt;br&gt;Charleston, SC 29492
&lt;br&gt;&lt;br&gt;mobile: &amp;nbsp;843-276-2808
&lt;br&gt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3965218&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;On Nov 7, 2009, at 10:17 AM, Trustin Lee (이희승) wrote:
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; A HashedWheelTimer creates only one thread. &amp;nbsp;If you create many
&lt;br&gt;&amp;gt; instances of HashedWheelTimer, you will see many threads, and it's
&lt;br&gt;&amp;gt; improper use. &amp;nbsp;There's no thread leak if used properly.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; If you want to make it pull a thread from a pool, you can specify a
&lt;br&gt;&amp;gt; custom ThreadFactory in the constructor. &amp;nbsp; However, I don't think this
&lt;br&gt;&amp;gt; is related with thread leak.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; — Trustin Lee, &lt;a href=&quot;http://gleamynode.net/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://gleamynode.net/&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; On Wed, Nov 4, 2009 at 1:36 AM, Garry Watkins &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3965218&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt; &amp;nbsp;
&lt;br&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt; Ok I fixed item one.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; However for item two, shouldn't it just check threads out of the
&lt;br&gt;&amp;gt;&amp;gt; thread pool and return the thread when it is done? &amp;nbsp;We have clients
&lt;br&gt;&amp;gt;&amp;gt; with terrible networks, and it really bugs me that it will leak
&lt;br&gt;&amp;gt;&amp;gt; threads every time that the network disconnects my server.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Thanks for your help
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Garry Watkins
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Managing Director
&lt;br&gt;&amp;gt;&amp;gt; DynaFOCUS, LLC
&lt;br&gt;&amp;gt;&amp;gt; 1097 Rivershore Rd.
&lt;br&gt;&amp;gt;&amp;gt; Charleston, SC 29492
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; mobile: &amp;nbsp;843-276-2808
&lt;br&gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3965218&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; On Nov 3, 2009, at 11:29 AM, Virat Gohil wrote:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; - Show quoted text -
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; On Tue, Nov 3, 2009 at 9:51 PM, Garry Watkins &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3965218&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Here is the pipeline factory code:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; public class PassThroughMasterPipelineFactory implements
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ChannelPipelineFactory {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; private short unitId;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; private Properties properties;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; private ClientBootstrap bootStrap;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; public PassThroughMasterPipelineFactory(short unitId, Properties
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; properties, ClientBootstrap bootStrap) {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; this.unitId = unitId;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; this.properties = properties;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; this.bootStrap = bootStrap;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; }
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; public ChannelPipeline getPipeline() throws Exception {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; ChannelPipeline pipeline = pipeline();
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; // &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;pipeline.addLast(&amp;quot;logger&amp;quot;, new
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; LoggingHandler(InternalLogLevel.INFO, false));
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; Timer timer = new HashedWheelTimer();
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; pipeline.addLast(&amp;quot;reconnect&amp;quot;, new PLCDisconnectHandler
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; (bootStrap,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; timer));
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; pipeline.addLast(&amp;quot;timeout&amp;quot;, new IdleStateHandler(timer, 5,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 10, 0));
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; UnitronicsLengthFieldBasedDecoder tcpFramer = new
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; UnitronicsLengthFieldBasedDecoder();
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; pipeline.addLast(&amp;quot;tcpFramer&amp;quot;, tcpFramer);
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; pipeline.addLast(&amp;quot;tcpCodec&amp;quot;, new TCPFrameCodec());
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; PLCStateMachine stateMachine = new PassThroughStateMachine
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; (unitId);
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; stateMachine.initializeScheduler(properties);
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; pipeline.addLast(&amp;quot;handler&amp;quot;, new
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; PLCStateMachineHandler(stateMachine));
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; pipeline.addLast(&amp;quot;test&amp;quot;, new RequestStatisticHandler());
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; return pipeline;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; }
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; }
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Garry Watkins wrote:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; I have a reconnect handler that handles closed channels and it
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; will try to
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; connect up after 10 seconds. &amp;nbsp;Every time that it opens the
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; connection back
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; up it creates a new thread. &amp;nbsp;I am not sure if it is the wheel
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; timer is
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; causing the leak or if there is something else. &amp;nbsp;I am willing to
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; try and
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; debug this if I can get a pointer in the right direction.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Here is what my code looks like:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; @ChannelPipelineCoverage(&amp;quot;one&amp;quot;)
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; public class PLCDisconnectHandler extends
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; SimpleChannelUpstreamHandler
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;private static final Log LOG =
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; LogFactory.getLog(PLCDisconnectHandler.class);
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;final ClientBootstrap bootstrap;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;private final Timer timer;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;public PLCDisconnectHandler(ClientBootstrap bootstrap, Timer
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; timer) {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.bootstrap = bootstrap;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.timer = timer;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;@Override
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;public void channelOpen(ChannelHandlerContext ctx,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ChannelStateEvent
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; e) throws Exception
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;{
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;LOG.error(&amp;quot;channelOpen&amp;quot;);
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;super.channelOpen(ctx, e);
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;@Override
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;public void channelConnected(ChannelHandlerContext ctx,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ChannelStateEvent e) throws Exception {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;LOG.error(&amp;quot;channelConnected: &amp;quot; +
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ctx.getChannel().getRemoteAddress().toString());
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;super.channelConnected(ctx, e);
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;@Override
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;public void channelDisconnected(ChannelHandlerContext ctx,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ChannelStateEvent e) throws Exception
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;{
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;LOG.error(&amp;quot;Channel disconnected: &amp;quot; +
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ctx.getChannel().getRemoteAddress().toString());
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;super.channelDisconnected(ctx, e);
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;@Override
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;public void channelClosed(ChannelHandlerContext ctx,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ChannelStateEvent
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; e) {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;LOG.error(&amp;quot;channelClosed&amp;quot;);
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;timer.newTimeout(new TimerTask() {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;public void run(Timeout timeout) throws Exception {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;timeout.cancel();
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;bootstrap.connect();
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}, 10, TimeUnit.SECONDS);
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;@Override
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;public void exceptionCaught(ChannelHandlerContext ctx,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ExceptionEvent
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; e) throws Exception {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (e.getCause() instanceof ConnectException){
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ctx.getChannel().close();
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; }
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; TIA
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Garry
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; --
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; View this message in context: &lt;a href=&quot;http://n2.nabble.com/HashedWheelTimer-is-leaking-threads-am-I-doing-something-wrong-tp3939379p3939502.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://n2.nabble.com/HashedWheelTimer-is-leaking-threads-am-I-doing-something-wrong-tp3939379p3939502.html&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Sent from the Netty User Group mailing list archive at Nabble.com.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; netty-users mailing list
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3965218&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Hmm,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 1. This is the reasons for leaks
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; public ChannelPipeline getPipeline() throws Exception {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; Timer timer = new HashedWheelTimer();
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; pipeline.addLast(&amp;quot;reconnect&amp;quot;, new PLCDisconnectHandler
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; (bootStrap,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; timer));
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; pipeline.addLast(&amp;quot;timeout&amp;quot;, new IdleStateHandler(timer, 5,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 10, 0));
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; You dont actually need a new instance for every pipeline, I suggest
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; that you create a single instance of timer and share it across all
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; channels as follows:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; public class PassThroughMasterPipelineFactory implements
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; ChannelPipelineFactory {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; private short unitId;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; private Properties properties;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; private ClientBootstrap bootStrap;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; private Timer timer;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; public PassThroughMasterPipelineFactory(short unitId, Properties
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; properties, ClientBootstrap bootStrap) {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; this.unitId = unitId;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; this.properties = properties;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; this.bootStrap = bootStrap;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; this.timer =new HashedWheelTimer();
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; }
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; public ChannelPipeline getPipeline() throws Exception {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; pipeline.addLast(&amp;quot;reconnect&amp;quot;, new
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; PLCDisconnectHandler(bootStrap, timer));
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; pipeline.addLast(&amp;quot;timeout&amp;quot;, new IdleStateHandler(timer, 5, 10,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 0));
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; }
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; And second:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;timer.newTimeout(new TimerTask() {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;public void run(Timeout timeout) throws Exception {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;timeout.cancel();
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;bootstrap.connect();
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}, 10, TimeUnit.SECONDS);
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; It basically creates a new thread every time a connection is closed.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Thanks,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Virat
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; netty-users mailing list
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3965218&amp;i=5&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt;&amp;gt; netty-users mailing list
&lt;br&gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3965218&amp;i=6&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&amp;gt;&amp;gt; &lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; netty-users mailing list
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3965218&amp;i=7&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;/div&gt;&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;netty-users mailing list
&lt;br&gt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3965218&amp;i=8&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/HashedWheelTimer-is-leaking-threads-am-I-doing-something-wrong-tp3939379p3965218.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3964499"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3964499</id>
	<title>Re: HashedWheelTimer is leaking threads, am I doing something wrong?</title>
	<published>2009-11-07T07:17:15Z</published>
	<updated>2009-11-07T07:17:15Z</updated>
	<author>
		<name>Trustin Lee</name>
	</author>
	<content type="html">A HashedWheelTimer creates only one thread. &amp;nbsp;If you create many
&lt;br&gt;instances of HashedWheelTimer, you will see many threads, and it's
&lt;br&gt;improper use. &amp;nbsp;There's no thread leak if used properly.
&lt;br&gt;&lt;br&gt;If you want to make it pull a thread from a pool, you can specify a
&lt;br&gt;custom ThreadFactory in the constructor. &amp;nbsp; However, I don't think this
&lt;br&gt;is related with thread leak.
&lt;br&gt;&lt;br&gt;— Trustin Lee, &lt;a href=&quot;http://gleamynode.net/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://gleamynode.net/&lt;/a&gt;&lt;br&gt;&lt;br&gt;On Wed, Nov 4, 2009 at 1:36 AM, Garry Watkins &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3964499&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Ok I fixed item one.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; However for item two, shouldn't it just check threads out of the
&lt;br&gt;&amp;gt; thread pool and return the thread when it is done?  We have clients
&lt;br&gt;&amp;gt; with terrible networks, and it really bugs me that it will leak
&lt;br&gt;&amp;gt; threads every time that the network disconnects my server.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Thanks for your help
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Garry Watkins
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Managing Director
&lt;br&gt;&amp;gt; DynaFOCUS, LLC
&lt;br&gt;&amp;gt; 1097 Rivershore Rd.
&lt;br&gt;&amp;gt; Charleston, SC 29492
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; mobile:  843-276-2808
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3964499&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; On Nov 3, 2009, at 11:29 AM, Virat Gohil wrote:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; - Show quoted text -
&lt;br&gt;&amp;gt;&amp;gt; On Tue, Nov 3, 2009 at 9:51 PM, Garry Watkins &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3964499&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Here is the pipeline factory code:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; public class PassThroughMasterPipelineFactory implements
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; ChannelPipelineFactory {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;   private short unitId;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;   private Properties properties;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;   private ClientBootstrap bootStrap;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;   public PassThroughMasterPipelineFactory(short unitId, Properties
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; properties, ClientBootstrap bootStrap) {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;       this.unitId = unitId;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;       this.properties = properties;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;       this.bootStrap = bootStrap;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;   }
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;   public ChannelPipeline getPipeline() throws Exception {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;       ChannelPipeline pipeline = pipeline();
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; //        pipeline.addLast(&amp;quot;logger&amp;quot;, new
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; LoggingHandler(InternalLogLevel.INFO, false));
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;       Timer timer = new HashedWheelTimer();
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;       pipeline.addLast(&amp;quot;reconnect&amp;quot;, new PLCDisconnectHandler
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; (bootStrap,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; timer));
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;       pipeline.addLast(&amp;quot;timeout&amp;quot;, new IdleStateHandler(timer, 5,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 10, 0));
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;       UnitronicsLengthFieldBasedDecoder tcpFramer = new
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; UnitronicsLengthFieldBasedDecoder();
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;       pipeline.addLast(&amp;quot;tcpFramer&amp;quot;, tcpFramer);
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;       pipeline.addLast(&amp;quot;tcpCodec&amp;quot;, new TCPFrameCodec());
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;       PLCStateMachine stateMachine = new PassThroughStateMachine
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; (unitId);
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;       stateMachine.initializeScheduler(properties);
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;       pipeline.addLast(&amp;quot;handler&amp;quot;, new
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; PLCStateMachineHandler(stateMachine));
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;       pipeline.addLast(&amp;quot;test&amp;quot;, new RequestStatisticHandler());
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;       return pipeline;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;   }
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; }
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Garry Watkins wrote:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; I have a reconnect handler that handles closed channels and it
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; will try to
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; connect up after 10 seconds.  Every time that it opens the
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; connection back
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; up it creates a new thread.  I am not sure if it is the wheel
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; timer is
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; causing the leak or if there is something else.  I am willing to
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; try and
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; debug this if I can get a pointer in the right direction.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Here is what my code looks like:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; @ChannelPipelineCoverage(&amp;quot;one&amp;quot;)
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; public class PLCDisconnectHandler extends
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; SimpleChannelUpstreamHandler
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;    private static final Log LOG =
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; LogFactory.getLog(PLCDisconnectHandler.class);
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;    final ClientBootstrap bootstrap;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;    private final Timer timer;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;    public PLCDisconnectHandler(ClientBootstrap bootstrap, Timer
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; timer) {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;        this.bootstrap = bootstrap;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;        this.timer = timer;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;    }
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;    @Override
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;    public void channelOpen(ChannelHandlerContext ctx,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ChannelStateEvent
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; e) throws Exception
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;    {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;        LOG.error(&amp;quot;channelOpen&amp;quot;);
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;        super.channelOpen(ctx, e);
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;    }
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;    @Override
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;    public void channelConnected(ChannelHandlerContext ctx,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ChannelStateEvent e) throws Exception {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;        LOG.error(&amp;quot;channelConnected: &amp;quot; +
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ctx.getChannel().getRemoteAddress().toString());
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;        super.channelConnected(ctx, e);
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;    }
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;    @Override
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;    public void channelDisconnected(ChannelHandlerContext ctx,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ChannelStateEvent e) throws Exception
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;    {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;        LOG.error(&amp;quot;Channel disconnected: &amp;quot; +
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ctx.getChannel().getRemoteAddress().toString());
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;        super.channelDisconnected(ctx, e);
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;    }
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;    @Override
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;    public void channelClosed(ChannelHandlerContext ctx,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ChannelStateEvent
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; e) {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;        LOG.error(&amp;quot;channelClosed&amp;quot;);
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;        timer.newTimeout(new TimerTask() {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;            public void run(Timeout timeout) throws Exception {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;                timeout.cancel();
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;                bootstrap.connect();
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;            }
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;        }, 10, TimeUnit.SECONDS);
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;    }
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;    @Override
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;    public void exceptionCaught(ChannelHandlerContext ctx,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ExceptionEvent
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; e) throws Exception {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;        if (e.getCause() instanceof ConnectException){
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;            ctx.getChannel().close();
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;        }
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;    }
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; }
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; TIA
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Garry
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; --
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; View this message in context: &lt;a href=&quot;http://n2.nabble.com/HashedWheelTimer-is-leaking-threads-am-I-doing-something-wrong-tp3939379p3939502.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://n2.nabble.com/HashedWheelTimer-is-leaking-threads-am-I-doing-something-wrong-tp3939379p3939502.html&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Sent from the Netty User Group mailing list archive at Nabble.com.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; netty-users mailing list
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3964499&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Hmm,
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; 1. This is the reasons for leaks
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;   public ChannelPipeline getPipeline() throws Exception {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;       Timer timer = new HashedWheelTimer();
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;       pipeline.addLast(&amp;quot;reconnect&amp;quot;, new PLCDisconnectHandler
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; (bootStrap,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; timer));
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;       pipeline.addLast(&amp;quot;timeout&amp;quot;, new IdleStateHandler(timer, 5,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 10, 0));
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; You dont actually need a new instance for every pipeline, I suggest
&lt;br&gt;&amp;gt;&amp;gt; that you create a single instance of timer and share it across all
&lt;br&gt;&amp;gt;&amp;gt; channels as follows:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; public class PassThroughMasterPipelineFactory implements
&lt;br&gt;&amp;gt;&amp;gt; ChannelPipelineFactory {
&lt;br&gt;&amp;gt;&amp;gt;   private short unitId;
&lt;br&gt;&amp;gt;&amp;gt;   private Properties properties;
&lt;br&gt;&amp;gt;&amp;gt;   private ClientBootstrap bootStrap;
&lt;br&gt;&amp;gt;&amp;gt;   private Timer timer;
&lt;br&gt;&amp;gt;&amp;gt;   public PassThroughMasterPipelineFactory(short unitId, Properties
&lt;br&gt;&amp;gt;&amp;gt; properties, ClientBootstrap bootStrap) {
&lt;br&gt;&amp;gt;&amp;gt;       this.unitId = unitId;
&lt;br&gt;&amp;gt;&amp;gt;       this.properties = properties;
&lt;br&gt;&amp;gt;&amp;gt;       this.bootStrap = bootStrap;
&lt;br&gt;&amp;gt;&amp;gt;       this.timer =new HashedWheelTimer();
&lt;br&gt;&amp;gt;&amp;gt;   }
&lt;br&gt;&amp;gt;&amp;gt;   public ChannelPipeline getPipeline() throws Exception {
&lt;br&gt;&amp;gt;&amp;gt;       pipeline.addLast(&amp;quot;reconnect&amp;quot;, new
&lt;br&gt;&amp;gt;&amp;gt; PLCDisconnectHandler(bootStrap, timer));
&lt;br&gt;&amp;gt;&amp;gt;       pipeline.addLast(&amp;quot;timeout&amp;quot;, new IdleStateHandler(timer, 5, 10,
&lt;br&gt;&amp;gt;&amp;gt; 0));
&lt;br&gt;&amp;gt;&amp;gt;   }
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; And second:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;        timer.newTimeout(new TimerTask() {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;            public void run(Timeout timeout) throws Exception {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;                timeout.cancel();
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;                bootstrap.connect();
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;            }
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;        }, 10, TimeUnit.SECONDS);
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; It basically creates a new thread every time a connection is closed.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Thanks,
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Virat
&lt;br&gt;&amp;gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt;&amp;gt; netty-users mailing list
&lt;br&gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3964499&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&amp;gt;&amp;gt; &lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; netty-users mailing list
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3964499&amp;i=5&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;/div&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;netty-users mailing list
&lt;br&gt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3964499&amp;i=6&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&lt;div class=&quot;signature&quot;&gt;— Trustin Lee, &lt;a href=&quot;http://gleamynode.net/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://gleamynode.net/&lt;/a&gt;&lt;/div&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/HashedWheelTimer-is-leaking-threads-am-I-doing-something-wrong-tp3939379p3964499.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3939623"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3939623</id>
	<title>Re: HashedWheelTimer is leaking threads, am I doing something wrong?</title>
	<published>2009-11-03T08:36:25Z</published>
	<updated>2009-11-03T08:36:25Z</updated>
	<author>
		<name>Garry Watkins</name>
	</author>
	<content type="html">Ok I fixed item one.
&lt;br&gt;&lt;br&gt;However for item two, shouldn't it just check threads out of the &amp;nbsp;
&lt;br&gt;thread pool and return the thread when it is done? &amp;nbsp;We have clients &amp;nbsp;
&lt;br&gt;with terrible networks, and it really bugs me that it will leak &amp;nbsp;
&lt;br&gt;threads every time that the network disconnects my server.
&lt;br&gt;&lt;br&gt;Thanks for your help
&lt;br&gt;&lt;br&gt;Garry Watkins
&lt;br&gt;&lt;br&gt;Managing Director
&lt;br&gt;DynaFOCUS, LLC
&lt;br&gt;1097 Rivershore Rd.
&lt;br&gt;Charleston, SC 29492
&lt;br&gt;&lt;br&gt;mobile: &amp;nbsp;843-276-2808
&lt;br&gt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3939623&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;On Nov 3, 2009, at 11:29 AM, Virat Gohil wrote:
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; - Show quoted text -
&lt;br&gt;&amp;gt; On Tue, Nov 3, 2009 at 9:51 PM, Garry Watkins &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3939623&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt; &amp;nbsp;
&lt;br&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Here is the pipeline factory code:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; public class PassThroughMasterPipelineFactory implements
&lt;br&gt;&amp;gt;&amp;gt; ChannelPipelineFactory {
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; private short unitId;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; private Properties properties;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; private ClientBootstrap bootStrap;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; public PassThroughMasterPipelineFactory(short unitId, Properties
&lt;br&gt;&amp;gt;&amp;gt; properties, ClientBootstrap bootStrap) {
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; this.unitId = unitId;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; this.properties = properties;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; this.bootStrap = bootStrap;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; }
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; public ChannelPipeline getPipeline() throws Exception {
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; ChannelPipeline pipeline = pipeline();
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; // &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;pipeline.addLast(&amp;quot;logger&amp;quot;, new
&lt;br&gt;&amp;gt;&amp;gt; LoggingHandler(InternalLogLevel.INFO, false));
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; Timer timer = new HashedWheelTimer();
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; pipeline.addLast(&amp;quot;reconnect&amp;quot;, new PLCDisconnectHandler 
&lt;br&gt;&amp;gt;&amp;gt; (bootStrap,
&lt;br&gt;&amp;gt;&amp;gt; timer));
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; pipeline.addLast(&amp;quot;timeout&amp;quot;, new IdleStateHandler(timer, 5, &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt; 10, 0));
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; UnitronicsLengthFieldBasedDecoder tcpFramer = new
&lt;br&gt;&amp;gt;&amp;gt; UnitronicsLengthFieldBasedDecoder();
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; pipeline.addLast(&amp;quot;tcpFramer&amp;quot;, tcpFramer);
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; pipeline.addLast(&amp;quot;tcpCodec&amp;quot;, new TCPFrameCodec());
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; PLCStateMachine stateMachine = new PassThroughStateMachine 
&lt;br&gt;&amp;gt;&amp;gt; (unitId);
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; stateMachine.initializeScheduler(properties);
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; pipeline.addLast(&amp;quot;handler&amp;quot;, new
&lt;br&gt;&amp;gt;&amp;gt; PLCStateMachineHandler(stateMachine));
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; pipeline.addLast(&amp;quot;test&amp;quot;, new RequestStatisticHandler());
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; return pipeline;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; }
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; }
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Garry Watkins wrote:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; I have a reconnect handler that handles closed channels and it &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; will try to
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; connect up after 10 seconds. &amp;nbsp;Every time that it opens the &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; connection back
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; up it creates a new thread. &amp;nbsp;I am not sure if it is the wheel &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; timer is
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; causing the leak or if there is something else. &amp;nbsp;I am willing to &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; try and
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; debug this if I can get a pointer in the right direction.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Here is what my code looks like:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; @ChannelPipelineCoverage(&amp;quot;one&amp;quot;)
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; public class PLCDisconnectHandler extends &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; SimpleChannelUpstreamHandler
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;private static final Log LOG =
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; LogFactory.getLog(PLCDisconnectHandler.class);
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;final ClientBootstrap bootstrap;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;private final Timer timer;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;public PLCDisconnectHandler(ClientBootstrap bootstrap, Timer &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; timer) {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.bootstrap = bootstrap;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.timer = timer;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;@Override
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;public void channelOpen(ChannelHandlerContext ctx, &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; ChannelStateEvent
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; e) throws Exception
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;{
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;LOG.error(&amp;quot;channelOpen&amp;quot;);
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;super.channelOpen(ctx, e);
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;@Override
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;public void channelConnected(ChannelHandlerContext ctx,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; ChannelStateEvent e) throws Exception {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;LOG.error(&amp;quot;channelConnected: &amp;quot; +
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; ctx.getChannel().getRemoteAddress().toString());
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;super.channelConnected(ctx, e);
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;@Override
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;public void channelDisconnected(ChannelHandlerContext ctx,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; ChannelStateEvent e) throws Exception
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;{
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;LOG.error(&amp;quot;Channel disconnected: &amp;quot; +
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; ctx.getChannel().getRemoteAddress().toString());
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;super.channelDisconnected(ctx, e);
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;@Override
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;public void channelClosed(ChannelHandlerContext ctx, &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; ChannelStateEvent
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; e) {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;LOG.error(&amp;quot;channelClosed&amp;quot;);
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;timer.newTimeout(new TimerTask() {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;public void run(Timeout timeout) throws Exception {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;timeout.cancel();
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;bootstrap.connect();
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}, 10, TimeUnit.SECONDS);
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;@Override
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;public void exceptionCaught(ChannelHandlerContext ctx, &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; ExceptionEvent
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; e) throws Exception {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (e.getCause() instanceof ConnectException){
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ctx.getChannel().close();
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; }
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; TIA
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Garry
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; --
&lt;br&gt;&amp;gt;&amp;gt; View this message in context: &lt;a href=&quot;http://n2.nabble.com/HashedWheelTimer-is-leaking-threads-am-I-doing-something-wrong-tp3939379p3939502.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://n2.nabble.com/HashedWheelTimer-is-leaking-threads-am-I-doing-something-wrong-tp3939379p3939502.html&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt; Sent from the Netty User Group mailing list archive at Nabble.com.
&lt;br&gt;&amp;gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt;&amp;gt; netty-users mailing list
&lt;br&gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3939623&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&amp;gt;&amp;gt; &lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Hmm,
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; 1. This is the reasons for leaks
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; public ChannelPipeline getPipeline() throws Exception {
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; Timer timer = new HashedWheelTimer();
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; pipeline.addLast(&amp;quot;reconnect&amp;quot;, new PLCDisconnectHandler 
&lt;br&gt;&amp;gt;&amp;gt; (bootStrap,
&lt;br&gt;&amp;gt;&amp;gt; timer));
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; pipeline.addLast(&amp;quot;timeout&amp;quot;, new IdleStateHandler(timer, 5, &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt; 10, 0));
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; You dont actually need a new instance for every pipeline, I suggest
&lt;br&gt;&amp;gt; that you create a single instance of timer and share it across all
&lt;br&gt;&amp;gt; channels as follows:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; public class PassThroughMasterPipelineFactory implements
&lt;br&gt;&amp;gt; ChannelPipelineFactory {
&lt;br&gt;&amp;gt; &amp;nbsp; private short unitId;
&lt;br&gt;&amp;gt; &amp;nbsp; private Properties properties;
&lt;br&gt;&amp;gt; &amp;nbsp; private ClientBootstrap bootStrap;
&lt;br&gt;&amp;gt; &amp;nbsp; private Timer timer;
&lt;br&gt;&amp;gt; &amp;nbsp; public PassThroughMasterPipelineFactory(short unitId, Properties
&lt;br&gt;&amp;gt; properties, ClientBootstrap bootStrap) {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; this.unitId = unitId;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; this.properties = properties;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; this.bootStrap = bootStrap;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; this.timer =new HashedWheelTimer();
&lt;br&gt;&amp;gt; &amp;nbsp; }
&lt;br&gt;&amp;gt; &amp;nbsp; public ChannelPipeline getPipeline() throws Exception {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; pipeline.addLast(&amp;quot;reconnect&amp;quot;, new
&lt;br&gt;&amp;gt; PLCDisconnectHandler(bootStrap, timer));
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; pipeline.addLast(&amp;quot;timeout&amp;quot;, new IdleStateHandler(timer, 5, 10, &amp;nbsp;
&lt;br&gt;&amp;gt; 0));
&lt;br&gt;&amp;gt; &amp;nbsp; }
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; And second:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;timer.newTimeout(new TimerTask() {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;public void run(Timeout timeout) throws Exception {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;timeout.cancel();
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;bootstrap.connect();
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}, 10, TimeUnit.SECONDS);
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; It basically creates a new thread every time a connection is closed.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Thanks,
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Virat
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; netty-users mailing list
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3939623&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;/div&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;netty-users mailing list
&lt;br&gt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3939623&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/HashedWheelTimer-is-leaking-threads-am-I-doing-something-wrong-tp3939379p3939623.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3939584"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3939584</id>
	<title>Re: HashedWheelTimer is leaking threads, am I doing something wrong?</title>
	<published>2009-11-03T08:29:57Z</published>
	<updated>2009-11-03T08:29:57Z</updated>
	<author>
		<name>Virat Gohil-3</name>
	</author>
	<content type="html">- Show quoted text -
&lt;br&gt;On Tue, Nov 3, 2009 at 9:51 PM, Garry Watkins &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3939584&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Here is the pipeline factory code:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; public class PassThroughMasterPipelineFactory implements
&lt;br&gt;&amp;gt; ChannelPipelineFactory {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;private short unitId;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;private Properties properties;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;private ClientBootstrap bootStrap;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;public PassThroughMasterPipelineFactory(short unitId, Properties
&lt;br&gt;&amp;gt; properties, ClientBootstrap bootStrap) {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.unitId = unitId;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.properties = properties;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.bootStrap = bootStrap;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;public ChannelPipeline getPipeline() throws Exception {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ChannelPipeline pipeline = pipeline();
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; // &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;pipeline.addLast(&amp;quot;logger&amp;quot;, new
&lt;br&gt;&amp;gt; LoggingHandler(InternalLogLevel.INFO, false));
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Timer timer = new HashedWheelTimer();
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;pipeline.addLast(&amp;quot;reconnect&amp;quot;, new PLCDisconnectHandler(bootStrap,
&lt;br&gt;&amp;gt; timer));
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;pipeline.addLast(&amp;quot;timeout&amp;quot;, new IdleStateHandler(timer, 5, 10, 0));
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;UnitronicsLengthFieldBasedDecoder tcpFramer = new
&lt;br&gt;&amp;gt; UnitronicsLengthFieldBasedDecoder();
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;pipeline.addLast(&amp;quot;tcpFramer&amp;quot;, tcpFramer);
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;pipeline.addLast(&amp;quot;tcpCodec&amp;quot;, new TCPFrameCodec());
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;PLCStateMachine stateMachine = new PassThroughStateMachine(unitId);
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;stateMachine.initializeScheduler(properties);
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;pipeline.addLast(&amp;quot;handler&amp;quot;, new
&lt;br&gt;&amp;gt; PLCStateMachineHandler(stateMachine));
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;pipeline.addLast(&amp;quot;test&amp;quot;, new RequestStatisticHandler());
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return pipeline;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; }
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Garry Watkins wrote:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; I have a reconnect handler that handles closed channels and it will try to
&lt;br&gt;&amp;gt;&amp;gt; connect up after 10 seconds. &amp;nbsp;Every time that it opens the connection back
&lt;br&gt;&amp;gt;&amp;gt; up it creates a new thread. &amp;nbsp;I am not sure if it is the wheel timer is
&lt;br&gt;&amp;gt;&amp;gt; causing the leak or if there is something else. &amp;nbsp;I am willing to try and
&lt;br&gt;&amp;gt;&amp;gt; debug this if I can get a pointer in the right direction.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Here is what my code looks like:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; @ChannelPipelineCoverage(&amp;quot;one&amp;quot;)
&lt;br&gt;&amp;gt;&amp;gt; public class PLCDisconnectHandler extends SimpleChannelUpstreamHandler
&lt;br&gt;&amp;gt;&amp;gt; {
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; private static final Log LOG =
&lt;br&gt;&amp;gt;&amp;gt; LogFactory.getLog(PLCDisconnectHandler.class);
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; final ClientBootstrap bootstrap;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; private final Timer timer;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; public PLCDisconnectHandler(ClientBootstrap bootstrap, Timer timer) {
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; this.bootstrap = bootstrap;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; this.timer = timer;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; @Override
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent
&lt;br&gt;&amp;gt;&amp;gt; e) throws Exception
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; {
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; LOG.error(&amp;quot;channelOpen&amp;quot;);
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; super.channelOpen(ctx, e);
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; @Override
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; public void channelConnected(ChannelHandlerContext ctx,
&lt;br&gt;&amp;gt;&amp;gt; ChannelStateEvent e) throws Exception {
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; LOG.error(&amp;quot;channelConnected: &amp;quot; +
&lt;br&gt;&amp;gt;&amp;gt; ctx.getChannel().getRemoteAddress().toString());
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; super.channelConnected(ctx, e);
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; @Override
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; public void channelDisconnected(ChannelHandlerContext ctx,
&lt;br&gt;&amp;gt;&amp;gt; ChannelStateEvent e) throws Exception
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; {
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; LOG.error(&amp;quot;Channel disconnected: &amp;quot; +
&lt;br&gt;&amp;gt;&amp;gt; ctx.getChannel().getRemoteAddress().toString());
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; super.channelDisconnected(ctx, e);
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; @Override
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent
&lt;br&gt;&amp;gt;&amp;gt; e) {
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; LOG.error(&amp;quot;channelClosed&amp;quot;);
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; timer.newTimeout(new TimerTask() {
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public void run(Timeout timeout) throws Exception {
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; timeout.cancel();
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bootstrap.connect();
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }, 10, TimeUnit.SECONDS);
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; @Override
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent
&lt;br&gt;&amp;gt;&amp;gt; e) throws Exception {
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (e.getCause() instanceof ConnectException){
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ctx.getChannel().close();
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;gt;&amp;gt; }
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; TIA
&lt;br&gt;&amp;gt;&amp;gt; Garry
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; --
&lt;br&gt;&amp;gt; View this message in context: &lt;a href=&quot;http://n2.nabble.com/HashedWheelTimer-is-leaking-threads-am-I-doing-something-wrong-tp3939379p3939502.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://n2.nabble.com/HashedWheelTimer-is-leaking-threads-am-I-doing-something-wrong-tp3939379p3939502.html&lt;/a&gt;&lt;br&gt;&amp;gt; Sent from the Netty User Group mailing list archive at Nabble.com.
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; netty-users mailing list
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3939584&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;/div&gt;&lt;br&gt;Hmm,
&lt;br&gt;&lt;br&gt;1. This is the reasons for leaks
&lt;br&gt;&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;public ChannelPipeline getPipeline() throws Exception {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Timer timer = new HashedWheelTimer();
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;pipeline.addLast(&amp;quot;reconnect&amp;quot;, new PLCDisconnectHandler(bootStrap,
&lt;br&gt;&amp;gt; timer));
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;pipeline.addLast(&amp;quot;timeout&amp;quot;, new IdleStateHandler(timer, 5, 10, 0));
&lt;br&gt;&lt;br&gt;You dont actually need a new instance for every pipeline, I suggest
&lt;br&gt;that you create a single instance of timer and share it across all
&lt;br&gt;channels as follows:
&lt;br&gt;&lt;br&gt;&lt;br&gt;&amp;nbsp;public class PassThroughMasterPipelineFactory implements
&lt;br&gt;&amp;nbsp;ChannelPipelineFactory {
&lt;br&gt;&amp;nbsp; &amp;nbsp;private short unitId;
&lt;br&gt;&amp;nbsp; &amp;nbsp;private Properties properties;
&lt;br&gt;&amp;nbsp; &amp;nbsp;private ClientBootstrap bootStrap;
&lt;br&gt;&amp;nbsp; &amp;nbsp;private Timer timer;
&lt;br&gt;&amp;nbsp; &amp;nbsp;public PassThroughMasterPipelineFactory(short unitId, Properties
&lt;br&gt;&amp;nbsp;properties, ClientBootstrap bootStrap) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.unitId = unitId;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.properties = properties;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.bootStrap = bootStrap;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.timer =new HashedWheelTimer();
&lt;br&gt;&amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;nbsp; &amp;nbsp;public ChannelPipeline getPipeline() throws Exception {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;pipeline.addLast(&amp;quot;reconnect&amp;quot;, new
&lt;br&gt;PLCDisconnectHandler(bootStrap, timer));
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;pipeline.addLast(&amp;quot;timeout&amp;quot;, new IdleStateHandler(timer, 5, 10, 0));
&lt;br&gt;&amp;nbsp; &amp;nbsp;}
&lt;br&gt;&lt;br&gt;And second:
&lt;br&gt;&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; timer.newTimeout(new TimerTask() {
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public void run(Timeout timeout) throws Exception {
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; timeout.cancel();
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bootstrap.connect();
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }, 10, TimeUnit.SECONDS);
&lt;br&gt;&lt;br&gt;It basically creates a new thread every time a connection is closed.
&lt;br&gt;&lt;br&gt;Thanks,
&lt;br&gt;&lt;br&gt;Virat
&lt;br&gt;_______________________________________________
&lt;br&gt;netty-users mailing list
&lt;br&gt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3939584&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/HashedWheelTimer-is-leaking-threads-am-I-doing-something-wrong-tp3939379p3939584.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3939557"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3939557</id>
	<title>Re: HashedWheelTimer is leaking threads, am I doing something wrong?</title>
	<published>2009-11-03T08:28:51Z</published>
	<updated>2009-11-03T08:28:51Z</updated>
	<author>
		<name>Virat Gohil</name>
	</author>
	<content type="html">On Tue, Nov 3, 2009 at 9:51 PM, Garry Watkins &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3939557&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Here is the pipeline factory code:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; public class PassThroughMasterPipelineFactory implements
&lt;br&gt;&amp;gt; ChannelPipelineFactory {
&lt;br&gt;&amp;gt;    private short unitId;
&lt;br&gt;&amp;gt;    private Properties properties;
&lt;br&gt;&amp;gt;    private ClientBootstrap bootStrap;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;    public PassThroughMasterPipelineFactory(short unitId, Properties
&lt;br&gt;&amp;gt; properties, ClientBootstrap bootStrap) {
&lt;br&gt;&amp;gt;        this.unitId = unitId;
&lt;br&gt;&amp;gt;        this.properties = properties;
&lt;br&gt;&amp;gt;        this.bootStrap = bootStrap;
&lt;br&gt;&amp;gt;    }
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;    public ChannelPipeline getPipeline() throws Exception {
&lt;br&gt;&amp;gt;        ChannelPipeline pipeline = pipeline();
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; //        pipeline.addLast(&amp;quot;logger&amp;quot;, new
&lt;br&gt;&amp;gt; LoggingHandler(InternalLogLevel.INFO, false));
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;        Timer timer = new HashedWheelTimer();
&lt;br&gt;&amp;gt;        pipeline.addLast(&amp;quot;reconnect&amp;quot;, new PLCDisconnectHandler(bootStrap,
&lt;br&gt;&amp;gt; timer));
&lt;br&gt;&amp;gt;        pipeline.addLast(&amp;quot;timeout&amp;quot;, new IdleStateHandler(timer, 5, 10, 0));
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;        UnitronicsLengthFieldBasedDecoder tcpFramer = new
&lt;br&gt;&amp;gt; UnitronicsLengthFieldBasedDecoder();
&lt;br&gt;&amp;gt;        pipeline.addLast(&amp;quot;tcpFramer&amp;quot;, tcpFramer);
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;        pipeline.addLast(&amp;quot;tcpCodec&amp;quot;, new TCPFrameCodec());
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;        PLCStateMachine stateMachine = new PassThroughStateMachine(unitId);
&lt;br&gt;&amp;gt;        stateMachine.initializeScheduler(properties);
&lt;br&gt;&amp;gt;        pipeline.addLast(&amp;quot;handler&amp;quot;, new
&lt;br&gt;&amp;gt; PLCStateMachineHandler(stateMachine));
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;        pipeline.addLast(&amp;quot;test&amp;quot;, new RequestStatisticHandler());
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;        return pipeline;
&lt;br&gt;&amp;gt;    }
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; }
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Garry Watkins wrote:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; I have a reconnect handler that handles closed channels and it will try to
&lt;br&gt;&amp;gt;&amp;gt; connect up after 10 seconds.  Every time that it opens the connection back
&lt;br&gt;&amp;gt;&amp;gt; up it creates a new thread.  I am not sure if it is the wheel timer is
&lt;br&gt;&amp;gt;&amp;gt; causing the leak or if there is something else.  I am willing to try and
&lt;br&gt;&amp;gt;&amp;gt; debug this if I can get a pointer in the right direction.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Here is what my code looks like:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; @ChannelPipelineCoverage(&amp;quot;one&amp;quot;)
&lt;br&gt;&amp;gt;&amp;gt; public class PLCDisconnectHandler extends SimpleChannelUpstreamHandler
&lt;br&gt;&amp;gt;&amp;gt; {
&lt;br&gt;&amp;gt;&amp;gt;     private static final Log LOG =
&lt;br&gt;&amp;gt;&amp;gt; LogFactory.getLog(PLCDisconnectHandler.class);
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;     final ClientBootstrap bootstrap;
&lt;br&gt;&amp;gt;&amp;gt;     private final Timer timer;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;     public PLCDisconnectHandler(ClientBootstrap bootstrap, Timer timer) {
&lt;br&gt;&amp;gt;&amp;gt;         this.bootstrap = bootstrap;
&lt;br&gt;&amp;gt;&amp;gt;         this.timer = timer;
&lt;br&gt;&amp;gt;&amp;gt;     }
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;     @Override
&lt;br&gt;&amp;gt;&amp;gt;     public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent
&lt;br&gt;&amp;gt;&amp;gt; e) throws Exception
&lt;br&gt;&amp;gt;&amp;gt;     {
&lt;br&gt;&amp;gt;&amp;gt;         LOG.error(&amp;quot;channelOpen&amp;quot;);
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;         super.channelOpen(ctx, e);
&lt;br&gt;&amp;gt;&amp;gt;     }
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;     @Override
&lt;br&gt;&amp;gt;&amp;gt;     public void channelConnected(ChannelHandlerContext ctx,
&lt;br&gt;&amp;gt;&amp;gt; ChannelStateEvent e) throws Exception {
&lt;br&gt;&amp;gt;&amp;gt;         LOG.error(&amp;quot;channelConnected: &amp;quot; +
&lt;br&gt;&amp;gt;&amp;gt; ctx.getChannel().getRemoteAddress().toString());
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;         super.channelConnected(ctx, e);
&lt;br&gt;&amp;gt;&amp;gt;     }
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;     @Override
&lt;br&gt;&amp;gt;&amp;gt;     public void channelDisconnected(ChannelHandlerContext ctx,
&lt;br&gt;&amp;gt;&amp;gt; ChannelStateEvent e) throws Exception
&lt;br&gt;&amp;gt;&amp;gt;     {
&lt;br&gt;&amp;gt;&amp;gt;         LOG.error(&amp;quot;Channel disconnected: &amp;quot; +
&lt;br&gt;&amp;gt;&amp;gt; ctx.getChannel().getRemoteAddress().toString());
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;         super.channelDisconnected(ctx, e);
&lt;br&gt;&amp;gt;&amp;gt;     }
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;     @Override
&lt;br&gt;&amp;gt;&amp;gt;     public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent
&lt;br&gt;&amp;gt;&amp;gt; e) {
&lt;br&gt;&amp;gt;&amp;gt;         LOG.error(&amp;quot;channelClosed&amp;quot;);
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;         timer.newTimeout(new TimerTask() {
&lt;br&gt;&amp;gt;&amp;gt;             public void run(Timeout timeout) throws Exception {
&lt;br&gt;&amp;gt;&amp;gt;                 timeout.cancel();
&lt;br&gt;&amp;gt;&amp;gt;                 bootstrap.connect();
&lt;br&gt;&amp;gt;&amp;gt;             }
&lt;br&gt;&amp;gt;&amp;gt;         }, 10, TimeUnit.SECONDS);
&lt;br&gt;&amp;gt;&amp;gt;     }
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;     @Override
&lt;br&gt;&amp;gt;&amp;gt;     public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent
&lt;br&gt;&amp;gt;&amp;gt; e) throws Exception {
&lt;br&gt;&amp;gt;&amp;gt;         if (e.getCause() instanceof ConnectException){
&lt;br&gt;&amp;gt;&amp;gt;             ctx.getChannel().close();
&lt;br&gt;&amp;gt;&amp;gt;         }
&lt;br&gt;&amp;gt;&amp;gt;     }
&lt;br&gt;&amp;gt;&amp;gt; }
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; TIA
&lt;br&gt;&amp;gt;&amp;gt; Garry
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; --
&lt;br&gt;&amp;gt; View this message in context: &lt;a href=&quot;http://n2.nabble.com/HashedWheelTimer-is-leaking-threads-am-I-doing-something-wrong-tp3939379p3939502.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://n2.nabble.com/HashedWheelTimer-is-leaking-threads-am-I-doing-something-wrong-tp3939379p3939502.html&lt;/a&gt;&lt;br&gt;&amp;gt; Sent from the Netty User Group mailing list archive at Nabble.com.
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; netty-users mailing list
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3939557&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;/div&gt;&lt;br&gt;Hmm,
&lt;br&gt;&lt;br&gt;1. This is the reasons for leaks
&lt;br&gt;&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;public ChannelPipeline getPipeline() throws Exception {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Timer timer = new HashedWheelTimer();
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;pipeline.addLast(&amp;quot;reconnect&amp;quot;, new PLCDisconnectHandler(bootStrap,
&lt;br&gt;&amp;gt; timer));
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;pipeline.addLast(&amp;quot;timeout&amp;quot;, new IdleStateHandler(timer, 5, 10, 0));
&lt;br&gt;&lt;br&gt;You dont actually need a new instance for every pipeline, I suggest
&lt;br&gt;that you create a single instance of timer and share it across all
&lt;br&gt;channels as follows:
&lt;br&gt;&lt;br&gt;&lt;br&gt;&amp;nbsp;public class PassThroughMasterPipelineFactory implements
&lt;br&gt;&amp;nbsp;ChannelPipelineFactory {
&lt;br&gt;&amp;nbsp; &amp;nbsp; private short unitId;
&lt;br&gt;&amp;nbsp; &amp;nbsp; private Properties properties;
&lt;br&gt;&amp;nbsp; &amp;nbsp; private ClientBootstrap bootStrap;
&lt;br&gt;&amp;nbsp; &amp;nbsp; private Timer timer;
&lt;br&gt;&amp;nbsp; &amp;nbsp; public PassThroughMasterPipelineFactory(short unitId, Properties
&lt;br&gt;&amp;nbsp;properties, ClientBootstrap bootStrap) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; this.unitId = unitId;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; this.properties = properties;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; this.bootStrap = bootStrap;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; this.timer =new HashedWheelTimer();
&lt;br&gt;&amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; public ChannelPipeline getPipeline() throws Exception {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pipeline.addLast(&amp;quot;reconnect&amp;quot;, new
&lt;br&gt;PLCDisconnectHandler(bootStrap, timer));
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pipeline.addLast(&amp;quot;timeout&amp;quot;, new IdleStateHandler(timer, 5, 10, 0));
&lt;br&gt;&amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;And second:
&lt;br&gt;&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; timer.newTimeout(new TimerTask() {
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public void run(Timeout timeout) throws Exception {
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; timeout.cancel();
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bootstrap.connect();
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }, 10, TimeUnit.SECONDS);
&lt;br&gt;&lt;br&gt;It basically creates a new thread every time a connection is closed.
&lt;br&gt;&lt;br&gt;Thanks,
&lt;br&gt;&lt;br&gt;Virat
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;netty-users mailing list
&lt;br&gt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3939557&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/HashedWheelTimer-is-leaking-threads-am-I-doing-something-wrong-tp3939379p3939557.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3939502"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3939502</id>
	<title>Re: HashedWheelTimer is leaking threads, am I doing something wrong?</title>
	<published>2009-11-03T08:21:56Z</published>
	<updated>2009-11-03T08:21:56Z</updated>
	<author>
		<name>Garry Watkins</name>
	</author>
	<content type="html">Here is the pipeline factory code:
&lt;br&gt;&lt;br&gt;public class PassThroughMasterPipelineFactory implements ChannelPipelineFactory {
&lt;br&gt;&amp;nbsp; &amp;nbsp; private short unitId;
&lt;br&gt;&amp;nbsp; &amp;nbsp; private Properties properties;
&lt;br&gt;&amp;nbsp; &amp;nbsp; private ClientBootstrap bootStrap;
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; public PassThroughMasterPipelineFactory(short unitId, Properties properties, ClientBootstrap bootStrap) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; this.unitId = unitId;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; this.properties = properties;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; this.bootStrap = bootStrap;
&lt;br&gt;&amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; public ChannelPipeline getPipeline() throws Exception {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ChannelPipeline pipeline = pipeline();
&lt;br&gt;&lt;br&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;pipeline.addLast(&amp;quot;logger&amp;quot;, new LoggingHandler(InternalLogLevel.INFO, false));
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Timer timer = new HashedWheelTimer();
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pipeline.addLast(&amp;quot;reconnect&amp;quot;, new PLCDisconnectHandler(bootStrap, timer));
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pipeline.addLast(&amp;quot;timeout&amp;quot;, new IdleStateHandler(timer, 5, 10, 0));
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; UnitronicsLengthFieldBasedDecoder tcpFramer = new UnitronicsLengthFieldBasedDecoder();
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pipeline.addLast(&amp;quot;tcpFramer&amp;quot;, tcpFramer);
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pipeline.addLast(&amp;quot;tcpCodec&amp;quot;, new TCPFrameCodec());
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PLCStateMachine stateMachine = new PassThroughStateMachine(unitId);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; stateMachine.initializeScheduler(properties);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pipeline.addLast(&amp;quot;handler&amp;quot;, new PLCStateMachineHandler(stateMachine));
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pipeline.addLast(&amp;quot;test&amp;quot;, new RequestStatisticHandler());
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return pipeline;
&lt;br&gt;&amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; 
&lt;br&gt;}
&lt;br&gt;&lt;br&gt;&lt;blockquote class=&quot;quote light-black dark-border-color&quot;&gt;&lt;div class=&quot;quote light-border-color&quot;&gt;
&lt;div class=&quot;quote-author&quot; style=&quot;font-weight: bold;&quot;&gt;Garry Watkins wrote:&lt;/div&gt;
&lt;div class=&quot;quote-message shrinkable-quote&quot;&gt;I have a reconnect handler that handles closed channels and it will try to connect up after 10 seconds. &amp;nbsp;Every time that it opens the connection back up it creates a new thread. &amp;nbsp;I am not sure if it is the wheel timer is causing the leak or if there is something else. &amp;nbsp;I am willing to try and debug this if I can get a pointer in the right direction.
&lt;br&gt;&lt;br&gt;Here is what my code looks like:
&lt;br&gt;&lt;br&gt;@ChannelPipelineCoverage(&amp;quot;one&amp;quot;)
&lt;br&gt;public class PLCDisconnectHandler extends SimpleChannelUpstreamHandler
&lt;br&gt;{
&lt;br&gt;&amp;nbsp; &amp;nbsp; private static final Log LOG = LogFactory.getLog(PLCDisconnectHandler.class);
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; final ClientBootstrap bootstrap;
&lt;br&gt;&amp;nbsp; &amp;nbsp; private final Timer timer;
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; public PLCDisconnectHandler(ClientBootstrap bootstrap, Timer timer) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; this.bootstrap = bootstrap;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; this.timer = timer;
&lt;br&gt;&amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; @Override
&lt;br&gt;&amp;nbsp; &amp;nbsp; public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception
&lt;br&gt;&amp;nbsp; &amp;nbsp; {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; LOG.error(&amp;quot;channelOpen&amp;quot;);
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; super.channelOpen(ctx, e);
&lt;br&gt;&amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; @Override
&lt;br&gt;&amp;nbsp; &amp;nbsp; public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; LOG.error(&amp;quot;channelConnected: &amp;quot; + &amp;nbsp;ctx.getChannel().getRemoteAddress().toString());
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; super.channelConnected(ctx, e);
&lt;br&gt;&amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; @Override
&lt;br&gt;&amp;nbsp; &amp;nbsp; public void channelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception
&lt;br&gt;&amp;nbsp; &amp;nbsp; {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; LOG.error(&amp;quot;Channel disconnected: &amp;quot; + ctx.getChannel().getRemoteAddress().toString());
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; super.channelDisconnected(ctx, e);
&lt;br&gt;&amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; @Override
&lt;br&gt;&amp;nbsp; &amp;nbsp; public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; LOG.error(&amp;quot;channelClosed&amp;quot;);
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; timer.newTimeout(new TimerTask() {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public void run(Timeout timeout) throws Exception {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; timeout.cancel();
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bootstrap.connect();
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }, 10, TimeUnit.SECONDS);
&lt;br&gt;&amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; @Override
&lt;br&gt;&amp;nbsp; &amp;nbsp; public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (e.getCause() instanceof ConnectException){
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ctx.getChannel().close();
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; }
&lt;br&gt;}
&lt;br&gt;&lt;br&gt;TIA
&lt;br&gt;Garry
&lt;/div&gt;
&lt;/div&gt;&lt;/blockquote&gt;
</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/HashedWheelTimer-is-leaking-threads-am-I-doing-something-wrong-tp3939379p3939502.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3939379"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3939459</id>
	<title>Re: HashedWheelTimer is leaking threads, am I doing something wrong?</title>
	<published>2009-11-03T08:14:25Z</published>
	<updated>2009-11-03T08:14:25Z</updated>
	<author>
		<name>Virat Gohil-3</name>
	</author>
	<content type="html">On Tue, Nov 3, 2009 at 9:34 PM, Garry Watkins &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3939459&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I have a reconnect handler that handles closed channels and it will try to
&lt;br&gt;&amp;gt; connect up after 10 seconds.  Every time that it opens the connection back
&lt;br&gt;&amp;gt; up it creates a new thread.  I am not sure if it is the wheel timer is
&lt;br&gt;&amp;gt; causing the leak or if there is something else.  I am willing to try and
&lt;br&gt;&amp;gt; debug this if I can get a pointer in the right direction.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Here is what my code looks like:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; @ChannelPipelineCoverage(&amp;quot;one&amp;quot;)
&lt;br&gt;&amp;gt; public class PLCDisconnectHandler extends SimpleChannelUpstreamHandler
&lt;br&gt;&amp;gt; {
&lt;br&gt;&amp;gt;    private static final Log LOG =
&lt;br&gt;&amp;gt; LogFactory.getLog(PLCDisconnectHandler.class);
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;    final ClientBootstrap bootstrap;
&lt;br&gt;&amp;gt;    private final Timer timer;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;    public PLCDisconnectHandler(ClientBootstrap bootstrap, Timer timer) {
&lt;br&gt;&amp;gt;        this.bootstrap = bootstrap;
&lt;br&gt;&amp;gt;        this.timer = timer;
&lt;br&gt;&amp;gt;    }
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;    @Override
&lt;br&gt;&amp;gt;    public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e)
&lt;br&gt;&amp;gt; throws Exception
&lt;br&gt;&amp;gt;    {
&lt;br&gt;&amp;gt;        LOG.error(&amp;quot;channelOpen&amp;quot;);
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;        super.channelOpen(ctx, e);
&lt;br&gt;&amp;gt;    }
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;    @Override
&lt;br&gt;&amp;gt;    public void channelConnected(ChannelHandlerContext ctx,
&lt;br&gt;&amp;gt; ChannelStateEvent e) throws Exception {
&lt;br&gt;&amp;gt;        LOG.error(&amp;quot;channelConnected: &amp;quot; +
&lt;br&gt;&amp;gt; ctx.getChannel().getRemoteAddress().toString());
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;        super.channelConnected(ctx, e);
&lt;br&gt;&amp;gt;    }
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;    @Override
&lt;br&gt;&amp;gt;    public void channelDisconnected(ChannelHandlerContext ctx,
&lt;br&gt;&amp;gt; ChannelStateEvent e) throws Exception
&lt;br&gt;&amp;gt;    {
&lt;br&gt;&amp;gt;        LOG.error(&amp;quot;Channel disconnected: &amp;quot; +
&lt;br&gt;&amp;gt; ctx.getChannel().getRemoteAddress().toString());
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;        super.channelDisconnected(ctx, e);
&lt;br&gt;&amp;gt;    }
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;    @Override
&lt;br&gt;&amp;gt;    public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent
&lt;br&gt;&amp;gt; e) {
&lt;br&gt;&amp;gt;        LOG.error(&amp;quot;channelClosed&amp;quot;);
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;        timer.newTimeout(new TimerTask() {
&lt;br&gt;&amp;gt;            public void run(Timeout timeout) throws Exception {
&lt;br&gt;&amp;gt;                timeout.cancel();
&lt;br&gt;&amp;gt;                bootstrap.connect();
&lt;br&gt;&amp;gt;            }
&lt;br&gt;&amp;gt;        }, 10, TimeUnit.SECONDS);
&lt;br&gt;&amp;gt;    }
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;    @Override
&lt;br&gt;&amp;gt;    public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e)
&lt;br&gt;&amp;gt; throws Exception {
&lt;br&gt;&amp;gt;        if (e.getCause() instanceof ConnectException){
&lt;br&gt;&amp;gt;            ctx.getChannel().close();
&lt;br&gt;&amp;gt;        }
&lt;br&gt;&amp;gt;    }
&lt;br&gt;&amp;gt; }
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; TIA
&lt;br&gt;&amp;gt; Garry
&lt;/div&gt;&lt;br&gt;Hi Garry,
&lt;br&gt;&lt;br&gt;Can you please post the code where you create a pipeline?
&lt;br&gt;&lt;br&gt;Thanks,
&lt;br&gt;&lt;br&gt;Virat
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;netty-users mailing list
&lt;br&gt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3939459&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/HashedWheelTimer-is-leaking-threads-am-I-doing-something-wrong-tp3939379p3939459.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3939379"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3939379</id>
	<title>HashedWheelTimer is leaking threads, am I doing something wrong?</title>
	<published>2009-11-03T08:04:37Z</published>
	<updated>2009-11-03T08:04:37Z</updated>
	<author>
		<name>Garry Watkins</name>
	</author>
	<content type="html">I have a reconnect handler that handles closed channels and it will try to connect up after 10 seconds. &amp;nbsp;Every time that it opens the connection back up it creates a new thread. &amp;nbsp;I am not sure if it is the wheel timer is causing the leak or if there is something else. &amp;nbsp;I am willing to try and debug this if I can get a pointer in the right direction.
&lt;br&gt;&lt;br&gt;Here is what my code looks like:
&lt;br&gt;&lt;br&gt;@ChannelPipelineCoverage(&amp;quot;one&amp;quot;)
&lt;br&gt;public class PLCDisconnectHandler extends SimpleChannelUpstreamHandler
&lt;br&gt;{
&lt;br&gt;&amp;nbsp; &amp;nbsp; private static final Log LOG = LogFactory.getLog(PLCDisconnectHandler.class);
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; final ClientBootstrap bootstrap;
&lt;br&gt;&amp;nbsp; &amp;nbsp; private final Timer timer;
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; public PLCDisconnectHandler(ClientBootstrap bootstrap, Timer timer) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; this.bootstrap = bootstrap;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; this.timer = timer;
&lt;br&gt;&amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; @Override
&lt;br&gt;&amp;nbsp; &amp;nbsp; public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception
&lt;br&gt;&amp;nbsp; &amp;nbsp; {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; LOG.error(&amp;quot;channelOpen&amp;quot;);
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; super.channelOpen(ctx, e);
&lt;br&gt;&amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; @Override
&lt;br&gt;&amp;nbsp; &amp;nbsp; public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; LOG.error(&amp;quot;channelConnected: &amp;quot; + &amp;nbsp;ctx.getChannel().getRemoteAddress().toString());
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; super.channelConnected(ctx, e);
&lt;br&gt;&amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; @Override
&lt;br&gt;&amp;nbsp; &amp;nbsp; public void channelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception
&lt;br&gt;&amp;nbsp; &amp;nbsp; {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; LOG.error(&amp;quot;Channel disconnected: &amp;quot; + ctx.getChannel().getRemoteAddress().toString());
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; super.channelDisconnected(ctx, e);
&lt;br&gt;&amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; @Override
&lt;br&gt;&amp;nbsp; &amp;nbsp; public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; LOG.error(&amp;quot;channelClosed&amp;quot;);
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; timer.newTimeout(new TimerTask() {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public void run(Timeout timeout) throws Exception {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; timeout.cancel();
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bootstrap.connect();
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }, 10, TimeUnit.SECONDS);
&lt;br&gt;&amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; @Override
&lt;br&gt;&amp;nbsp; &amp;nbsp; public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (e.getCause() instanceof ConnectException){
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ctx.getChannel().close();
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; }
&lt;br&gt;}
&lt;br&gt;&lt;br&gt;TIA
&lt;br&gt;Garry</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/HashedWheelTimer-is-leaking-threads-am-I-doing-something-wrong-tp3939379p3939379.html" />
	
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3967720</id>
	<title>Re: Random connect exceptions</title>
	<published>2009-11-08T02:22:26Z</published>
	<updated>2009-11-08T02:22:26Z</updated>
	<author>
		<name>Shay Banon</name>
	</author>
	<content type="html">Here is the client bootstrap initialization:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; clientBootstrap = new ClientBootstrap(new
&lt;br&gt;NioClientSocketChannelFactory(new VirtualExecutorService(threadPool),
&lt;br&gt;new VirtualExecutorService(threadPool)));
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ChannelPipelineFactory clientPipelineFactory = new
&lt;br&gt;ChannelPipelineFactory() {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @Override public ChannelPipeline getPipeline() throws Exception {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ChannelPipeline pipeline = Channels.pipeline();
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pipeline.addLast(&amp;quot;decoder&amp;quot;, new SizeHeaderFrameDecoder());
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pipeline.addLast(&amp;quot;dispatcher&amp;quot;, new
&lt;br&gt;MessageChannelHandler(NettyTransport.this));
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return pipeline;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; };
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; clientBootstrap.setPipelineFactory(clientPipelineFactory);
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; clientBootstrap.setOption(&amp;quot;connectTimeoutMillis&amp;quot;,
&lt;br&gt;connectTimeout.millis());
&lt;br&gt;&lt;br&gt;And here is the connect operation:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ChannelFuture channelFuture = clientBootstrap.connect(address);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; channelFuture.awaitUninterruptibly();
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (!channelFuture.isSuccess()) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// throw connect excep
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return channelFuture.getChannel();
&lt;br&gt;&lt;br&gt;The server is a netty server bound to 0.0.0.0, and the address it to
&lt;br&gt;connect to is the local ip address (as derived by java, for example,
&lt;br&gt;192.168....).
&lt;br&gt;&lt;br&gt;Shay
&lt;br&gt;&lt;br&gt;&lt;br&gt;On Sun, Nov 8, 2009 at 11:22 AM, Trustin Lee (이희승) &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3967720&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Perhaps it might be a bug.  I will investigate a little bit more.
&lt;br&gt;&amp;gt; Could you paste the whole bootstrap initialization and connection
&lt;br&gt;&amp;gt; attempt code?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Thanks
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; — Trustin Lee, &lt;a href=&quot;http://gleamynode.net/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://gleamynode.net/&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; On Sun, Nov 8, 2009 at 5:38 PM, Shay Banon &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3967720&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt; I see. Now, when I try with waiting without any timeout value
&lt;br&gt;&amp;gt;&amp;gt; (channelFuture.awaitUninterruptibly()), then it simply hangs without
&lt;br&gt;&amp;gt;&amp;gt; returning. I do set the connectionTimeoutMillis... :
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; clientBootstrap.setOption(&amp;quot;connectTimeoutMillis&amp;quot;, connectTimeout.millis());
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; and it is set to 1 second.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Cheers,
&lt;br&gt;&amp;gt;&amp;gt; Shay
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; On Sat, Nov 7, 2009 at 5:09 PM, Trustin Lee (이희승) &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3967720&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; If you have specified connectTimeoutMillis option correctly, you
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; should not specify the timeout value when you call
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; ChannelFuture.await().  ChannelFuture will complete automatically on
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; connection timeout.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; You cannot assume that the connection attempt has failed if
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; ChannelFuture.isSuccess() returned false because it might also mean
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; that the connection attempt is still in progress.  To make sure that
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; the connection attempt is finished, you have to await the future until
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; its completion.  If ChannelFuture is complete, ChannelFuture.isDone()
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; returns true.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; HTH
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; — Trustin Lee, &lt;a href=&quot;http://gleamynode.net/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://gleamynode.net/&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; On Tue, Nov 3, 2009 at 11:49 PM, Shay Banon &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3967720&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Hi,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;  First of all, thanks for the reply. I have added the connectTimeout
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; option as you suggested, and it does not seem to help. Even when I set
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; it to a higher value, it simply waits there until the timeout passed,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; and then the channelFuture#isSuccess is false. I still don't get the
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; actual cause as well. I am using netty version 3.1.5.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;  What is the scenario that the cause of the future is null?
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Thanks,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Shay
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; On Tue, Nov 3, 2009 at 1:41 PM, Christian Migowski &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3967720&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Hi Shay,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; the code looks OK, but two things:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 1) did you set the connectTimeout to the bootstrap, i.e.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;  clientBootstrap.setOption(&amp;quot;connectTimeoutMillis&amp;quot;,connectTimeout.millis());
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; if no that might be the reason: the connection attempt is just not finished yet
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 2) if yes do you use the latest Netty version? The NIO transport in
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; versions prior to 3.1.4 (if i remember correctly) did not respect the
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; connect timeout.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; hth,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; regards,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; christian!
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; On Tue, Nov 3, 2009 at 12:19 PM, Shay Banon &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3967720&amp;i=5&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Hi,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;  I am getting random connect failures when using netty, which I am
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; trying to track down the cause of it. First, here is the code I use to
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; connect:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;            InetSocketAddress address = // obtain the address to connect to
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;            ChannelFuture channelFuture = clientBootstrap.connect(address);
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;            channelFuture.awaitUninterruptibly(connectTimeout.millis());
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; // connect timeout is 1 second
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;            if (!channelFuture.isSuccess()) {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;                throw new ConnectTransportException(address, &amp;quot;&amp;quot;,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; channelFuture.getCause());
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;            }
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; First, is this code fragment correct, or am I missing something?
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Second, the strange thing I get is that the channelFuture.getCause()
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; is null .., so I don't really know the underlying problem here.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Any idea?
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Cheers,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Shay
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; netty-users mailing list
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3967720&amp;i=6&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; netty-users mailing list
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3967720&amp;i=7&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; netty-users mailing list
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3967720&amp;i=8&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; netty-users mailing list
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3967720&amp;i=9&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt;&amp;gt; netty-users mailing list
&lt;br&gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3967720&amp;i=10&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&amp;gt;&amp;gt; &lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; netty-users mailing list
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3967720&amp;i=11&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;/div&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;netty-users mailing list
&lt;br&gt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3967720&amp;i=12&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/Random-connect-exceptions-tp3937859p3967720.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3967569"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3967569</id>
	<title>Re: Random connect exceptions</title>
	<published>2009-11-08T01:22:40Z</published>
	<updated>2009-11-08T01:22:40Z</updated>
	<author>
		<name>Trustin Lee</name>
	</author>
	<content type="html">Perhaps it might be a bug. &amp;nbsp;I will investigate a little bit more.
&lt;br&gt;Could you paste the whole bootstrap initialization and connection
&lt;br&gt;attempt code?
&lt;br&gt;&lt;br&gt;Thanks
&lt;br&gt;&lt;br&gt;— Trustin Lee, &lt;a href=&quot;http://gleamynode.net/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://gleamynode.net/&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;On Sun, Nov 8, 2009 at 5:38 PM, Shay Banon &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3967569&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; I see. Now, when I try with waiting without any timeout value
&lt;br&gt;&amp;gt; (channelFuture.awaitUninterruptibly()), then it simply hangs without
&lt;br&gt;&amp;gt; returning. I do set the connectionTimeoutMillis... :
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; clientBootstrap.setOption(&amp;quot;connectTimeoutMillis&amp;quot;, connectTimeout.millis());
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; and it is set to 1 second.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Cheers,
&lt;br&gt;&amp;gt; Shay
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; On Sat, Nov 7, 2009 at 5:09 PM, Trustin Lee (이희승) &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3967569&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt; If you have specified connectTimeoutMillis option correctly, you
&lt;br&gt;&amp;gt;&amp;gt; should not specify the timeout value when you call
&lt;br&gt;&amp;gt;&amp;gt; ChannelFuture.await().  ChannelFuture will complete automatically on
&lt;br&gt;&amp;gt;&amp;gt; connection timeout.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; You cannot assume that the connection attempt has failed if
&lt;br&gt;&amp;gt;&amp;gt; ChannelFuture.isSuccess() returned false because it might also mean
&lt;br&gt;&amp;gt;&amp;gt; that the connection attempt is still in progress.  To make sure that
&lt;br&gt;&amp;gt;&amp;gt; the connection attempt is finished, you have to await the future until
&lt;br&gt;&amp;gt;&amp;gt; its completion.  If ChannelFuture is complete, ChannelFuture.isDone()
&lt;br&gt;&amp;gt;&amp;gt; returns true.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; HTH
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; — Trustin Lee, &lt;a href=&quot;http://gleamynode.net/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://gleamynode.net/&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; On Tue, Nov 3, 2009 at 11:49 PM, Shay Banon &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3967569&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Hi,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;  First of all, thanks for the reply. I have added the connectTimeout
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; option as you suggested, and it does not seem to help. Even when I set
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; it to a higher value, it simply waits there until the timeout passed,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; and then the channelFuture#isSuccess is false. I still don't get the
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; actual cause as well. I am using netty version 3.1.5.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;  What is the scenario that the cause of the future is null?
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Thanks,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Shay
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; On Tue, Nov 3, 2009 at 1:41 PM, Christian Migowski &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3967569&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Hi Shay,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; the code looks OK, but two things:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 1) did you set the connectTimeout to the bootstrap, i.e.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;  clientBootstrap.setOption(&amp;quot;connectTimeoutMillis&amp;quot;,connectTimeout.millis());
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; if no that might be the reason: the connection attempt is just not finished yet
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 2) if yes do you use the latest Netty version? The NIO transport in
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; versions prior to 3.1.4 (if i remember correctly) did not respect the
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; connect timeout.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; hth,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; regards,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; christian!
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; On Tue, Nov 3, 2009 at 12:19 PM, Shay Banon &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3967569&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Hi,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;  I am getting random connect failures when using netty, which I am
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; trying to track down the cause of it. First, here is the code I use to
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; connect:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;            InetSocketAddress address = // obtain the address to connect to
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;            ChannelFuture channelFuture = clientBootstrap.connect(address);
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;            channelFuture.awaitUninterruptibly(connectTimeout.millis());
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; // connect timeout is 1 second
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;            if (!channelFuture.isSuccess()) {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;                throw new ConnectTransportException(address, &amp;quot;&amp;quot;,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; channelFuture.getCause());
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;            }
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; First, is this code fragment correct, or am I missing something?
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Second, the strange thing I get is that the channelFuture.getCause()
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; is null .., so I don't really know the underlying problem here.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Any idea?
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Cheers,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Shay
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; netty-users mailing list
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3967569&amp;i=5&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; netty-users mailing list
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3967569&amp;i=6&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; netty-users mailing list
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3967569&amp;i=7&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt;&amp;gt; netty-users mailing list
&lt;br&gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3967569&amp;i=8&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&amp;gt;&amp;gt; &lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; netty-users mailing list
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3967569&amp;i=9&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;/div&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;netty-users mailing list
&lt;br&gt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3967569&amp;i=10&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&lt;div class=&quot;signature&quot;&gt;— Trustin Lee, &lt;a href=&quot;http://gleamynode.net/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://gleamynode.net/&lt;/a&gt;&lt;/div&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/Random-connect-exceptions-tp3937859p3967569.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3967485"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3967485</id>
	<title>Re: Random connect exceptions</title>
	<published>2009-11-08T00:38:47Z</published>
	<updated>2009-11-08T00:38:47Z</updated>
	<author>
		<name>Shay Banon</name>
	</author>
	<content type="html">I see. Now, when I try with waiting without any timeout value
&lt;br&gt;(channelFuture.awaitUninterruptibly()), then it simply hangs without
&lt;br&gt;returning. I do set the connectionTimeoutMillis... :
&lt;br&gt;&lt;br&gt;clientBootstrap.setOption(&amp;quot;connectTimeoutMillis&amp;quot;, connectTimeout.millis());
&lt;br&gt;&lt;br&gt;and it is set to 1 second.
&lt;br&gt;&lt;br&gt;Cheers,
&lt;br&gt;Shay
&lt;br&gt;&lt;br&gt;On Sat, Nov 7, 2009 at 5:09 PM, Trustin Lee (이희승) &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3967485&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; If you have specified connectTimeoutMillis option correctly, you
&lt;br&gt;&amp;gt; should not specify the timeout value when you call
&lt;br&gt;&amp;gt; ChannelFuture.await().  ChannelFuture will complete automatically on
&lt;br&gt;&amp;gt; connection timeout.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; You cannot assume that the connection attempt has failed if
&lt;br&gt;&amp;gt; ChannelFuture.isSuccess() returned false because it might also mean
&lt;br&gt;&amp;gt; that the connection attempt is still in progress.  To make sure that
&lt;br&gt;&amp;gt; the connection attempt is finished, you have to await the future until
&lt;br&gt;&amp;gt; its completion.  If ChannelFuture is complete, ChannelFuture.isDone()
&lt;br&gt;&amp;gt; returns true.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; HTH
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; — Trustin Lee, &lt;a href=&quot;http://gleamynode.net/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://gleamynode.net/&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; On Tue, Nov 3, 2009 at 11:49 PM, Shay Banon &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3967485&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt; Hi,
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;  First of all, thanks for the reply. I have added the connectTimeout
&lt;br&gt;&amp;gt;&amp;gt; option as you suggested, and it does not seem to help. Even when I set
&lt;br&gt;&amp;gt;&amp;gt; it to a higher value, it simply waits there until the timeout passed,
&lt;br&gt;&amp;gt;&amp;gt; and then the channelFuture#isSuccess is false. I still don't get the
&lt;br&gt;&amp;gt;&amp;gt; actual cause as well. I am using netty version 3.1.5.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;  What is the scenario that the cause of the future is null?
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Thanks,
&lt;br&gt;&amp;gt;&amp;gt; Shay
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; On Tue, Nov 3, 2009 at 1:41 PM, Christian Migowski &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3967485&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Hi Shay,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; the code looks OK, but two things:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 1) did you set the connectTimeout to the bootstrap, i.e.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;  clientBootstrap.setOption(&amp;quot;connectTimeoutMillis&amp;quot;,connectTimeout.millis());
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; if no that might be the reason: the connection attempt is just not finished yet
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 2) if yes do you use the latest Netty version? The NIO transport in
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; versions prior to 3.1.4 (if i remember correctly) did not respect the
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; connect timeout.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; hth,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; regards,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; christian!
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; On Tue, Nov 3, 2009 at 12:19 PM, Shay Banon &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3967485&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Hi,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;  I am getting random connect failures when using netty, which I am
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; trying to track down the cause of it. First, here is the code I use to
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; connect:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;            InetSocketAddress address = // obtain the address to connect to
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;            ChannelFuture channelFuture = clientBootstrap.connect(address);
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;            channelFuture.awaitUninterruptibly(connectTimeout.millis());
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; // connect timeout is 1 second
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;            if (!channelFuture.isSuccess()) {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;                throw new ConnectTransportException(address, &amp;quot;&amp;quot;,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; channelFuture.getCause());
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;            }
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; First, is this code fragment correct, or am I missing something?
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Second, the strange thing I get is that the channelFuture.getCause()
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; is null .., so I don't really know the underlying problem here.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Any idea?
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Cheers,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Shay
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; netty-users mailing list
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3967485&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; netty-users mailing list
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3967485&amp;i=5&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt;&amp;gt; netty-users mailing list
&lt;br&gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3967485&amp;i=6&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&amp;gt;&amp;gt; &lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; netty-users mailing list
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3967485&amp;i=7&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;/div&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;netty-users mailing list
&lt;br&gt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3967485&amp;i=8&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/Random-connect-exceptions-tp3937859p3967485.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3964442"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3964442</id>
	<title>Re: Random connect exceptions</title>
	<published>2009-11-07T07:09:07Z</published>
	<updated>2009-11-07T07:09:07Z</updated>
	<author>
		<name>Trustin Lee</name>
	</author>
	<content type="html">If you have specified connectTimeoutMillis option correctly, you
&lt;br&gt;should not specify the timeout value when you call
&lt;br&gt;ChannelFuture.await(). &amp;nbsp;ChannelFuture will complete automatically on
&lt;br&gt;connection timeout.
&lt;br&gt;&lt;br&gt;You cannot assume that the connection attempt has failed if
&lt;br&gt;ChannelFuture.isSuccess() returned false because it might also mean
&lt;br&gt;that the connection attempt is still in progress. &amp;nbsp;To make sure that
&lt;br&gt;the connection attempt is finished, you have to await the future until
&lt;br&gt;its completion. &amp;nbsp;If ChannelFuture is complete, ChannelFuture.isDone()
&lt;br&gt;returns true.
&lt;br&gt;&lt;br&gt;HTH
&lt;br&gt;&lt;br&gt;— Trustin Lee, &lt;a href=&quot;http://gleamynode.net/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://gleamynode.net/&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;On Tue, Nov 3, 2009 at 11:49 PM, Shay Banon &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3964442&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Hi,
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;  First of all, thanks for the reply. I have added the connectTimeout
&lt;br&gt;&amp;gt; option as you suggested, and it does not seem to help. Even when I set
&lt;br&gt;&amp;gt; it to a higher value, it simply waits there until the timeout passed,
&lt;br&gt;&amp;gt; and then the channelFuture#isSuccess is false. I still don't get the
&lt;br&gt;&amp;gt; actual cause as well. I am using netty version 3.1.5.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;  What is the scenario that the cause of the future is null?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Thanks,
&lt;br&gt;&amp;gt; Shay
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; On Tue, Nov 3, 2009 at 1:41 PM, Christian Migowski &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3964442&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt; Hi Shay,
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; the code looks OK, but two things:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; 1) did you set the connectTimeout to the bootstrap, i.e.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;  clientBootstrap.setOption(&amp;quot;connectTimeoutMillis&amp;quot;,connectTimeout.millis());
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; if no that might be the reason: the connection attempt is just not finished yet
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; 2) if yes do you use the latest Netty version? The NIO transport in
&lt;br&gt;&amp;gt;&amp;gt; versions prior to 3.1.4 (if i remember correctly) did not respect the
&lt;br&gt;&amp;gt;&amp;gt; connect timeout.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; hth,
&lt;br&gt;&amp;gt;&amp;gt; regards,
&lt;br&gt;&amp;gt;&amp;gt; christian!
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; On Tue, Nov 3, 2009 at 12:19 PM, Shay Banon &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3964442&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Hi,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;  I am getting random connect failures when using netty, which I am
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; trying to track down the cause of it. First, here is the code I use to
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; connect:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;            InetSocketAddress address = // obtain the address to connect to
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;            ChannelFuture channelFuture = clientBootstrap.connect(address);
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;            channelFuture.awaitUninterruptibly(connectTimeout.millis());
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; // connect timeout is 1 second
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;            if (!channelFuture.isSuccess()) {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;                throw new ConnectTransportException(address, &amp;quot;&amp;quot;,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; channelFuture.getCause());
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;            }
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; First, is this code fragment correct, or am I missing something?
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Second, the strange thing I get is that the channelFuture.getCause()
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; is null .., so I don't really know the underlying problem here.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Any idea?
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Cheers,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Shay
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; netty-users mailing list
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3964442&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt;&amp;gt; netty-users mailing list
&lt;br&gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3964442&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&amp;gt;&amp;gt; &lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; netty-users mailing list
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3964442&amp;i=5&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;/div&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;netty-users mailing list
&lt;br&gt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3964442&amp;i=6&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&lt;div class=&quot;signature&quot;&gt;— Trustin Lee, &lt;a href=&quot;http://gleamynode.net/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://gleamynode.net/&lt;/a&gt;&lt;/div&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/Random-connect-exceptions-tp3937859p3964442.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3938901"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3938901</id>
	<title>Re: Random connect exceptions</title>
	<published>2009-11-03T06:49:02Z</published>
	<updated>2009-11-03T06:49:02Z</updated>
	<author>
		<name>Shay Banon</name>
	</author>
	<content type="html">Hi,
&lt;br&gt;&lt;br&gt;&amp;nbsp; First of all, thanks for the reply. I have added the connectTimeout
&lt;br&gt;option as you suggested, and it does not seem to help. Even when I set
&lt;br&gt;it to a higher value, it simply waits there until the timeout passed,
&lt;br&gt;and then the channelFuture#isSuccess is false. I still don't get the
&lt;br&gt;actual cause as well. I am using netty version 3.1.5.
&lt;br&gt;&lt;br&gt;&amp;nbsp; What is the scenario that the cause of the future is null?
&lt;br&gt;&lt;br&gt;Thanks,
&lt;br&gt;Shay
&lt;br&gt;&lt;br&gt;On Tue, Nov 3, 2009 at 1:41 PM, Christian Migowski &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3938901&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Hi Shay,
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; the code looks OK, but two things:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; 1) did you set the connectTimeout to the bootstrap, i.e.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;  clientBootstrap.setOption(&amp;quot;connectTimeoutMillis&amp;quot;,connectTimeout.millis());
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; if no that might be the reason: the connection attempt is just not finished yet
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; 2) if yes do you use the latest Netty version? The NIO transport in
&lt;br&gt;&amp;gt; versions prior to 3.1.4 (if i remember correctly) did not respect the
&lt;br&gt;&amp;gt; connect timeout.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; hth,
&lt;br&gt;&amp;gt; regards,
&lt;br&gt;&amp;gt; christian!
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; On Tue, Nov 3, 2009 at 12:19 PM, Shay Banon &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3938901&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt; Hi,
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;  I am getting random connect failures when using netty, which I am
&lt;br&gt;&amp;gt;&amp;gt; trying to track down the cause of it. First, here is the code I use to
&lt;br&gt;&amp;gt;&amp;gt; connect:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;            InetSocketAddress address = // obtain the address to connect to
&lt;br&gt;&amp;gt;&amp;gt;            ChannelFuture channelFuture = clientBootstrap.connect(address);
&lt;br&gt;&amp;gt;&amp;gt;            channelFuture.awaitUninterruptibly(connectTimeout.millis());
&lt;br&gt;&amp;gt;&amp;gt; // connect timeout is 1 second
&lt;br&gt;&amp;gt;&amp;gt;            if (!channelFuture.isSuccess()) {
&lt;br&gt;&amp;gt;&amp;gt;                throw new ConnectTransportException(address, &amp;quot;&amp;quot;,
&lt;br&gt;&amp;gt;&amp;gt; channelFuture.getCause());
&lt;br&gt;&amp;gt;&amp;gt;            }
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; First, is this code fragment correct, or am I missing something?
&lt;br&gt;&amp;gt;&amp;gt; Second, the strange thing I get is that the channelFuture.getCause()
&lt;br&gt;&amp;gt;&amp;gt; is null .., so I don't really know the underlying problem here.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Any idea?
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Cheers,
&lt;br&gt;&amp;gt;&amp;gt; Shay
&lt;br&gt;&amp;gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt;&amp;gt; netty-users mailing list
&lt;br&gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3938901&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&amp;gt;&amp;gt; &lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; netty-users mailing list
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3938901&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;/div&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;netty-users mailing list
&lt;br&gt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3938901&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/Random-connect-exceptions-tp3937859p3938901.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3937958"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3937958</id>
	<title>Re: Random connect exceptions</title>
	<published>2009-11-03T03:41:26Z</published>
	<updated>2009-11-03T03:41:26Z</updated>
	<author>
		<name>christian</name>
	</author>
	<content type="html">Hi Shay,
&lt;br&gt;&lt;br&gt;the code looks OK, but two things:
&lt;br&gt;&lt;br&gt;1) did you set the connectTimeout to the bootstrap, i.e.
&lt;br&gt;&lt;br&gt;&amp;nbsp;clientBootstrap.setOption(&amp;quot;connectTimeoutMillis&amp;quot;,connectTimeout.millis());
&lt;br&gt;&lt;br&gt;if no that might be the reason: the connection attempt is just not finished yet
&lt;br&gt;&lt;br&gt;2) if yes do you use the latest Netty version? The NIO transport in
&lt;br&gt;versions prior to 3.1.4 (if i remember correctly) did not respect the
&lt;br&gt;connect timeout.
&lt;br&gt;&lt;br&gt;hth,
&lt;br&gt;regards,
&lt;br&gt;christian!
&lt;br&gt;&lt;br&gt;&lt;br&gt;On Tue, Nov 3, 2009 at 12:19 PM, Shay Banon &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3937958&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Hi,
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;  I am getting random connect failures when using netty, which I am
&lt;br&gt;&amp;gt; trying to track down the cause of it. First, here is the code I use to
&lt;br&gt;&amp;gt; connect:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;            InetSocketAddress address = // obtain the address to connect to
&lt;br&gt;&amp;gt;            ChannelFuture channelFuture = clientBootstrap.connect(address);
&lt;br&gt;&amp;gt;            channelFuture.awaitUninterruptibly(connectTimeout.millis());
&lt;br&gt;&amp;gt; // connect timeout is 1 second
&lt;br&gt;&amp;gt;            if (!channelFuture.isSuccess()) {
&lt;br&gt;&amp;gt;                throw new ConnectTransportException(address, &amp;quot;&amp;quot;,
&lt;br&gt;&amp;gt; channelFuture.getCause());
&lt;br&gt;&amp;gt;            }
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; First, is this code fragment correct, or am I missing something?
&lt;br&gt;&amp;gt; Second, the strange thing I get is that the channelFuture.getCause()
&lt;br&gt;&amp;gt; is null .., so I don't really know the underlying problem here.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Any idea?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Cheers,
&lt;br&gt;&amp;gt; Shay
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; netty-users mailing list
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3937958&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;/div&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;netty-users mailing list
&lt;br&gt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3937958&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/Random-connect-exceptions-tp3937859p3937958.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3937859"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3937859</id>
	<title>Random connect exceptions</title>
	<published>2009-11-03T03:19:49Z</published>
	<updated>2009-11-03T03:19:49Z</updated>
	<author>
		<name>Shay Banon</name>
	</author>
	<content type="html">Hi,
&lt;br&gt;&lt;br&gt;&amp;nbsp; I am getting random connect failures when using netty, which I am
&lt;br&gt;trying to track down the cause of it. First, here is the code I use to
&lt;br&gt;connect:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; InetSocketAddress address = // obtain the address to connect to
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ChannelFuture channelFuture = clientBootstrap.connect(address);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; channelFuture.awaitUninterruptibly(connectTimeout.millis());
&lt;br&gt;// connect timeout is 1 second
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (!channelFuture.isSuccess()) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; throw new ConnectTransportException(address, &amp;quot;&amp;quot;,
&lt;br&gt;channelFuture.getCause());
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;&lt;br&gt;First, is this code fragment correct, or am I missing something?
&lt;br&gt;Second, the strange thing I get is that the channelFuture.getCause()
&lt;br&gt;is null .., so I don't really know the underlying problem here.
&lt;br&gt;&lt;br&gt;Any idea?
&lt;br&gt;&lt;br&gt;Cheers,
&lt;br&gt;Shay
&lt;br&gt;_______________________________________________
&lt;br&gt;netty-users mailing list
&lt;br&gt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3937859&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/Random-connect-exceptions-tp3937859p3937859.html" />
	
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3936945</id>
	<title>couple of questions i come up with.</title>
	<published>2009-11-02T23:30:06Z</published>
	<updated>2009-11-02T23:30:06Z</updated>
	<author>
		<name>Mert İnan</name>
	</author>
	<content type="html">Hi Netty Developer Group,
&lt;br&gt;&lt;br&gt;i am trying to get confortable with Netty(3.1.5). Here are a couple of questions i come up with.
&lt;br&gt;&lt;br&gt;1. Data comes into netty, it goes up and down through handlers. There may be many ChannelUpstreamHandler and ChannelDownstreamHandler handlers. In all those handlers,in general, should i use Channels.fireMessageReceived only once? if so when? what happens if Channels.fireMessageReceived is called more then once in up handlers?
&lt;br&gt;&lt;br&gt;2. What should i do when my decoder constructed by more than one handler? Is it required that Decoder must be implemented in one handler?
&lt;br&gt;&lt;br&gt;3. Why FrameDecoder.callDecode throws this Exception?
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; throw new IllegalStateException(
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;quot;decode() method must read at least one byte &amp;quot; +
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;quot;if it returned a frame (caused by: &amp;quot; + getClass() + &amp;quot;)&amp;quot;);
&lt;br&gt;&lt;br&gt;Thank you very much. </content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/couple-of-questions-i-come-up-with-tp3936945p3936945.html" />
	
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3964413</id>
	<title>Re: demultiplexing protobuf messages</title>
	<published>2009-11-07T07:02:25Z</published>
	<updated>2009-11-07T07:02:25Z</updated>
	<author>
		<name>Trustin Lee</name>
	</author>
	<content type="html">You are right. &amp;nbsp;However, if the decoder is placed after
&lt;br&gt;ExecutionHandler, decoder might be called from different threads while
&lt;br&gt;it's not called simultaneously, as described in
&lt;br&gt;OrderedMemoryAwareThreadPoolExecutor Javadoc. &amp;nbsp;If your decoder is
&lt;br&gt;placed before ExecutionHandler or you don't use ExecutionHandler at
&lt;br&gt;all, it's safe to define the member variables as non-volatile.
&lt;br&gt;&lt;br&gt;HTH
&lt;br&gt;&lt;br&gt;— Trustin Lee, &lt;a href=&quot;http://gleamynode.net/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://gleamynode.net/&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;On Wed, Nov 4, 2009 at 11:41 PM, sandstorm_sh &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3964413&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Thanks to both of you.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Why are those fields volatile ?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Isnt there a handler/decoder instance per pipeline/connection ?
&lt;br&gt;&amp;gt; --
&lt;br&gt;&amp;gt; View this message in context: &lt;a href=&quot;http://n2.nabble.com/demultiplexing-protobuf-messages-tp3931395p3945572.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://n2.nabble.com/demultiplexing-protobuf-messages-tp3931395p3945572.html&lt;/a&gt;&lt;br&gt;&amp;gt; Sent from the Netty User Group mailing list archive at Nabble.com.
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; netty-users mailing list
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3964413&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;/div&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;netty-users mailing list
&lt;br&gt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3964413&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&lt;div class=&quot;signature&quot;&gt;— Trustin Lee, &lt;a href=&quot;http://gleamynode.net/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://gleamynode.net/&lt;/a&gt;&lt;/div&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/demultiplexing-protobuf-messages-tp3931395p3964413.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3945572"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3945572</id>
	<title>Re: demultiplexing protobuf messages</title>
	<published>2009-11-04T06:41:22Z</published>
	<updated>2009-11-04T06:41:22Z</updated>
	<author>
		<name>sandstorm_sh</name>
	</author>
	<content type="html">Thanks to both of you.
&lt;br&gt;&lt;br&gt;Why are those fields volatile ?
&lt;br&gt;&lt;br&gt;Isnt there a handler/decoder instance per pipeline/connection ?</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/demultiplexing-protobuf-messages-tp3931395p3945572.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3937275"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3937275</id>
	<title>Re: demultiplexing protobuf messages</title>
	<published>2009-11-03T01:00:27Z</published>
	<updated>2009-11-03T01:00:27Z</updated>
	<author>
		<name>Trustin Lee</name>
	</author>
	<content type="html">On Mon, Nov 2, 2009 at 9:04 PM, sandstorm_sh &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3937275&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; How can we demultiplex protobuf messages, given the fact that a message has
&lt;br&gt;&amp;gt; not any type defining header information in itself, and the protocol we are
&lt;br&gt;&amp;gt; trying to define is message-flexible so to say, i.e. has not got any fixed
&lt;br&gt;&amp;gt; message sequence hardcoded into the protocol definition.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; one solution is to prepend the type header like a lengthfieldprepender
&lt;br&gt;&amp;gt; prepends a length field, and to decode the message with an appropriate
&lt;br&gt;&amp;gt; protobuf decoder.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; we can maintain a collection of decoders for the corresponding types, but
&lt;br&gt;&amp;gt; the problem is that the decode method is protected, not public, and we can
&lt;br&gt;&amp;gt; not invoke it.
&lt;br&gt;&amp;gt; so we should use the pipeline somehow, and my question is what is the
&lt;br&gt;&amp;gt; standard idiom for this particular situation: do we have to replace handlers
&lt;br&gt;&amp;gt; in the pipeline, based on the incoming message type ?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; what is the standard thing to do ?
&lt;/div&gt;&lt;br&gt;I would use DecoderEmbedder to decode the message whose type/length
&lt;br&gt;prefix stripped out. &amp;nbsp;It could look like this:
&lt;br&gt;&lt;br&gt;public class MyDecoder extends FrameDecoder {
&lt;br&gt;&amp;nbsp; &amp;nbsp; private volatile boolean readingHeader = true;
&lt;br&gt;&amp;nbsp; &amp;nbsp; private volatile int bodyLength;
&lt;br&gt;&amp;nbsp; &amp;nbsp; private volatile DecoderEmbedder bodyDecoder;
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; protected Object decode(ctx, ch, buf) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (readingHeader) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (buf.readableByte() &amp;lt; 8) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return null;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int messageType = buf.readInt();
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bodyLength = buf.readInt();
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; switch (messageType) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; case 1:
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bodyDecoder = new DecoderEmbedder(new MessageTypeOneDecoder());
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; break;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ....
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; readingHeader = false;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (!readingHeader) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (buf.readableBytes() &amp;lt; bodyLength) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bodyDecoder.offer(buf.readBytes(bodyLength));
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; readingHeader = true;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return bodyDecoder.poll();
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; }
&lt;br&gt;}
&lt;br&gt;&lt;br&gt;I'm not sure the code above is perfect as I didn't run it by myself,
&lt;br&gt;but it should show you some basic idea.
&lt;br&gt;&lt;br&gt;I also like Nicholas's idea, so I'd recommend it, too, if it's a
&lt;br&gt;viable option for you.
&lt;br&gt;&lt;br&gt;HTH
&lt;br&gt;&lt;br&gt;— Trustin Lee, &lt;a href=&quot;http://gleamynode.net/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://gleamynode.net/&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; example code in the netty distribution contains protobuf examples, but there
&lt;br&gt;&amp;gt; is one message type incoming and outgoing..
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; im a bit newbie in netty, so i'd like some elaboration on this topic, thanks
&lt;br&gt;&amp;gt; --
&lt;br&gt;&amp;gt; View this message in context: &lt;a href=&quot;http://n2.nabble.com/demultiplexing-protobuf-messages-tp3931395p3931395.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://n2.nabble.com/demultiplexing-protobuf-messages-tp3931395p3931395.html&lt;/a&gt;&lt;br&gt;&amp;gt; Sent from the Netty User Group mailing list archive at Nabble.com.
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; netty-users mailing list
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3937275&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;/div&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;netty-users mailing list
&lt;br&gt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3937275&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;&lt;div class=&quot;signature&quot;&gt;— Trustin Lee, &lt;a href=&quot;http://gleamynode.net/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://gleamynode.net/&lt;/a&gt;&lt;/div&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/demultiplexing-protobuf-messages-tp3931395p3937275.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3931395"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3932003</id>
	<title>Re: demultiplexing protobuf messages</title>
	<published>2009-11-02T06:20:10Z</published>
	<updated>2009-11-02T06:20:10Z</updated>
	<author>
		<name>Nicholas Clare</name>
	</author>
	<content type="html">Hi,&lt;br&gt;&lt;br&gt;I&amp;#39;m not really an expert on Protocol Buffers, but I&amp;#39;ve been looking at them recently for a project of mine. One possibility is to have a fixed message type that has &amp;quot;optional&amp;quot; fields for each possible type of message that could come in. If the types of possible messages is too flexible to make this a reasonable option, protocol buffers does have an extension mechanism, although I am not too familiar with it, but from what I remember it should also be a possibility.&lt;br&gt;
&lt;br&gt;If you can&amp;#39;t wrap all your messages in one container type, then I think the option you&amp;#39;re suggesting is definitely another option.&lt;br&gt;&lt;br&gt;Hope this helps a bit,&lt;br&gt;Nick&lt;br&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Mon, Nov 2, 2009 at 2:04 PM, sandstorm_sh &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3932003&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;
&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;&lt;br&gt;
How can we demultiplex protobuf messages, given the fact that a message has&lt;br&gt;
not any type defining header information in itself, and the protocol we are&lt;br&gt;
trying to define is message-flexible so to say, i.e. has not got any fixed&lt;br&gt;
message sequence hardcoded into the protocol definition.&lt;br&gt;
&lt;br&gt;
one solution is to prepend the type header like a lengthfieldprepender&lt;br&gt;
prepends a length field, and to decode the message with an appropriate&lt;br&gt;
protobuf decoder.&lt;br&gt;
&lt;br&gt;
we can maintain a collection of decoders for the corresponding types, but&lt;br&gt;
the problem is that the decode method is protected, not public, and we can&lt;br&gt;
not invoke it.&lt;br&gt;
&lt;br&gt;
so we should use the pipeline somehow, and my question is what is the&lt;br&gt;
standard idiom for this particular situation: do we have to replace handlers&lt;br&gt;
in the pipeline, based on the incoming message type ?&lt;br&gt;
&lt;br&gt;
what is the standard thing to do ?&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
example code in the netty distribution contains protobuf examples, but there&lt;br&gt;
is one message type incoming and outgoing..&lt;br&gt;
&lt;br&gt;
im a bit newbie in netty, so i&amp;#39;d like some elaboration on this topic, thanks&lt;br&gt;
&lt;font color=&quot;#888888&quot;&gt;--&lt;br&gt;
View this message in context: &lt;a href=&quot;http://n2.nabble.com/demultiplexing-protobuf-messages-tp3931395p3931395.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://n2.nabble.com/demultiplexing-protobuf-messages-tp3931395p3931395.html&lt;/a&gt;&lt;br&gt;
Sent from the Netty User Group mailing list archive at Nabble.com.&lt;br&gt;
_______________________________________________&lt;br&gt;
netty-users mailing list&lt;br&gt;
&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3932003&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&lt;br&gt;
&lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;
&lt;/font&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;
&lt;br /&gt;_______________________________________________
&lt;br&gt;netty-users mailing list
&lt;br&gt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3932003&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.jboss.org/mailman/listinfo/netty-users&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.jboss.org/mailman/listinfo/netty-users&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/demultiplexing-protobuf-messages-tp3931395p3932003.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3931395"/>
</entry>

</feed>
