Geoff/Guo
 
That's great, thanks.

Cheers Arv

-----Original Message-----
From: Wenrui Guo [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 08, 2008 12:30 AM
To: [email protected]; [EMAIL PROTECTED]
Subject: RE: Mina Throttling

Yes, Mina has a very useful IoFilter named ReadThrottleFilter, who
relies on IoSession.suspendRead() to take advantage of TCP flow control.

You can use following code to achieve such objective:

Connector = new NioSocketConnector();
Connector.getFilterChain().addLast("exec", new ExecutorFilter());
Connector.getFilterChain().addLast("throttle", new
ReadThrottleFilter(throttleExecutor, ReadThrottlePolicy.BLOCK));

Remember, throttleExecutor is a ScheduledExecutorService instance,
programmer must be reponsible for such executor's lifecycle. In other
words, you should shutdown it later when application is going to
shutdown.

BR
anderson 

-----Original Message-----
From: Geoff Cadien [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 07, 2008 12:02 AM
To: [email protected]
Subject: Re: Mina Throttling

On Wed, Aug 6, 2008 at 6:11 AM, Arv Mistry <[EMAIL PROTECTED]> wrote:

>
> Hi,
>
> I have a system which sends a very high throughput of messages. So one

> thing I wanted to be able to do during high loads is to take advantage

> of the TCP flow control i.e be able to throttle back on the TCP socket

> so as not to read off it until the processing catches up.
>
> Does anyone know is there way with Mina to tell it not to read from 
> the TCP socket? If I return false in the doDecode of the 
> ProtocolDecoder will that do it?


IoSession.suspendRead() will accomplish what you're asking for a single
tcp connection.

-geoff

Reply via email to