connections waiting on condition before sending the response

Benoit Perroud benoit at noisette.ch
Sun Jan 16 09:06:55 EST 2011


Hi again,

I went a bit further with my problem (and also my understanding of Netty 
:)).

I have the following flow now : a pipeline with an ExecutionHandler at 
the latest stage, which will put the MessageEvent into a queue which 
will processed by another thread in a near future. It works better, but 
the point is that I still cannot accept more than 2 connections at the 
same time, other coming connections stuck before the pipeline.

I initialize my ServerBoostrap like this :

ServerBootstrap bootstrap = new ServerBootstrap(
   new NioServerSocketChannelFactory(
     Executors.newCachedThreadPool(),
     Executors.newCachedThreadPool()));

Then I set the pipeline factory (with a shared pool executor at the 
latest stage) and finally I bind.

The connections wait as expected, but as soon as I have two connections 
waiting, no one can be processed. Seems like NO/I worker are not 
released for others connections.

What am I doing wrong ? Can someone give me a hint or a reference to dig 
into ?

Thanks in advance,

Kind regards,

Benoit.


On 01/15/2011 06:36 PM, Benoit Perroud wrote:
> Hi all,
>
> I'm really new in Netty, and I don't know where to begin to achieve 
> the following behavior :
>
> I have connections that should wait on a condition before sending the 
> response. For example "Hang all the client till a particular request 
> is done".
>
> I tried to put the Channel in a ChannelGroup in messageReceived, and 
> then to have a Runnable waiting on the condition and iterating on the 
> ChannelGroup when the condition is met.
>
> I also try to add a threadPool in the pipeline before my handler, but 
> my tires do not accept more than 2 connections, the other hang on.
>
> Thanks in advance,
>
> Kind regards,
>
> Benoit.
>


More information about the netty-users mailing list