<br><br><div class="gmail_quote">On Fri, Mar 5, 2010 at 10:39 PM, infectedrhytms <span dir="ltr">&lt;<a href="mailto:infectedrhythms@hotmail.com">infectedrhythms@hotmail.com</a>&gt;</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;">
<br>
Thanks! It seems to be working, but I still see an issue.<br>
<br>
I&#39;m trying to implement a server with netty using a persistent connection.<br>
I.e: The client will connect once and send all of it&#39;s messages over that 1<br>
connection. So now back to square one. If I implement 1 client connection 1<br>
1 request and close the socket with<br>
future.addListener(ChannelFutureListener.CLOSE); I get no problem.<br>
<br>
Here is the log of my C++ application connecting to my netty server...<br>
<br>
<br>
Client opens 1 connection sends 5 messages... Server takes about 500ms to<br>
process each request...<br>
<br>
[15:38:26.215] Thread1, Send to netty id 1<br>
[15:38:26.215] Thread1, Send to netty finished<br>
[15:38:26.215] Thread2, Send to netty id 2<br>
[15:38:26.215] Thread2, Send to netty finished<br>
[15:38:26.215] Thread3, Send to netty id 3<br>
[15:38:26.215] Thread3, Send to netty finished<br>
[15:38:26.215] Thread4, Send to netty id 4<br>
[15:38:26.215] Thread4, Send to netty finished<br>
[15:38:26.215] Thread5, Send to netty id 5<br>
[15:38:26.215] Thread5, Send to netty finished<br>
[15:38:26.715] Thread1, Received head length from bank: Length=211 (d3)<br>
[15:38:26.731] Response incoming...<br>
[15:38:26.731] Response is for id 1<br>
[15:38:27.231] Response incoming...<br>
[15:38:27.231] Response is for id 2<br>
[15:38:27.731] Response incoming...<br>
[15:38:27.731] Response is for id 3<br>
[15:38:28.231] Response incoming...<br>
[15:38:28.231] Response is for id 4<br>
[15:38:28.731] Response incoming...<br>
[15:38:28.731] Response is for id 5...<br>
<br>
So as you can see the 5 messages where all sent at the same time, but then<br>
each response came in 500ms after each other as if they where queued. If I<br>
implement 1 client connection  per 1 request and close the connection in the<br>
handler everything is ok. But I need to keep the connection open.<br>
<br>
This is my handler implementation<br>
<br>
public class MyHandler extends SimpleChannelHandler {<br>
        String request = (String) e.getMessage();<br>
<br>
// Do some stuff here...<br>
<br>
        ChannelFuture future = e.getChannel().write(response);<br>
<br>
        // Do not close we need to keep 1 connection per client<br>
        //future.addListener(ChannelFutureListener.CLOSE);<br>
}<br>
<font color="#888888"></font><br></blockquote><div> </div></div>From what you have described, it looks like your handler has some synchronized methods, or using synchronized methods while processing the requests. It would be best to turn on a profiler on the server and observe the behavior.<br>
<br>Have Fun!<br><br>Virat<br>