<br><div class="gmail_quote">On Fri, Mar 6, 2009 at 7:17 PM, Patrizio Munzi <span dir="ltr"><<a href="mailto:patrizio.munzi@eris4.com">patrizio.munzi@eris4.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Frederic,<br>
thanks for your tips.<br>
;-)<br>
In particular that one on ChannelGroup, it solved the problem in my other post.<br>
<br>
About OrderedMemoryAwareThreadPoolExecutor I don't think I need it.<br>
<br>
BR,<br>
Patrizio<div><div></div><div class="h5"><br>
<br>
Frederic Bregier wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Patrizio,<br>
<br>
For me, you have almost all.<br>
<br>
I could suggest the following:<br>
- adding the .setOption("reuseAddress", true) both on server (using "child.reuseAddress") and client sides<br>
<br>
- adding if necessary an OrderedMemoryAwareThreadPoolExecutor in your<br>
pipeline<br>
(that you could create once for all connections and reuse it)<br>
bewteen you "encoder" and "handler". This is only needed if your handler<br>
is doing stuff like database, file access, or any heavy computations.<br>
Heavy can depend on each case of software, so it is up to you to check<br>
if it is better or not.<br>
<br>
- perhaps using DefaultChannelGroup to add any created channel to it<br>
(either in client or server) in order to allow a shutdown of Netty<br>
more easily:<br>
<br>
In your "handler", you can add in the channelConnected a<br>
"myChannelGroup.add(channel)"<br>
<br>
Again in the "handler" in channelClosed, add a<br>
"myChannelGroup.remove(channel)"<br>
<br>
And finaly in your global exit command (like shutdown in your other post):<br>
myChannelGroup.close().awaitUninterruptibly(); // it should close all<br>
opened<br>
// channel, even the father in Server version<br>
then your "orderedMemoryAwareThreadPoolExecutor".shutdownNow(); // if you<br>
added one<br>
then your "channelFactory" (from new NioXXXSocketChannelFactory)<br>
"channelFactory".releaseExternalResources(); // should release all<br>
internals<br>
// like thread pools.<br>
<br>
I think it is all... ;-)<br>
HTH,<br>
Frederic<br>
<br>
-----<br>
Hardware/Software Architect<br>
<br>
</blockquote>
<br>
-- <br>
<br></div></div>
*Patrizio Munzi*<br>
</blockquote></div><br><br>
Hi Frederic,<br>
<br>
Thank you very much for sharing these tips with us. The tips will also be very useful for me too!! :)<br>
<br>
Cheers!<br>
<br>
Virat<br>