You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@mina.apache.org by Saurav Gulati <sa...@shephertz.co.in> on 2013/05/30 07:55:14 UTC

Query regarding keep alive

Hello Team,

I am using keep alive in my app. At session idle
to count idle event what should in them
session.getBothIdleCount() or session.getReaderIdleCount()

Regards,

Saurav

Re: Query regarding keep alive

Posted by Emmanuel Lécharny <el...@gmail.com>.
Le 5/30/13 8:48 AM, Saurav Gulati a écrit :
> I am relying on the session idle event to detect if a client got
> disconnected (in case of un-graceful connection break). To do this I have
> added logic to my TCP clients to send a "keep alive" message every 2
> seconds. And I have configured the server to detect idle events using
> acceptor.getSessionConfig().setIdleTime(IdleStatus.READER_IDLE, 2);
>
> When I get 3 consecutive idle events - my server logic assumes that the
> client is disconnected and closes the session. I get the count using
> int readerIdleEventCount = session.getReaderIdleCount();
>
> Is the above logic the right way to handle my scenario? 

Basically, yes.

> I want to
> understand when I should use READER_IDLE/WRITER_IDLE/BOTH_IDLE?
MINA can detect sessions getting idle in both ways (read and write). In
your case, it's probably enough to use the READER event. (I'm not even
sure if it makes sense at all to check the WRITE idling anyway..)

Hope it helps.


-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com 


Re: Query regarding keep alive

Posted by Saurav Gulati <sa...@shephertz.co.in>.
I am relying on the session idle event to detect if a client got
disconnected (in case of un-graceful connection break). To do this I have
added logic to my TCP clients to send a "keep alive" message every 2
seconds. And I have configured the server to detect idle events using
acceptor.getSessionConfig().setIdleTime(IdleStatus.READER_IDLE, 2);

When I get 3 consecutive idle events - my server logic assumes that the
client is disconnected and closes the session. I get the count using
int readerIdleEventCount = session.getReaderIdleCount();

Is the above logic the right way to handle my scenario? I want to
understand when I should use READER_IDLE/WRITER_IDLE/BOTH_IDLE?

Thanks,
Saurav





On Thu, May 30, 2013 at 12:01 PM, Emmanuel Lécharny <el...@gmail.com>wrote:

> Le 5/30/13 7:55 AM, Saurav Gulati a écrit :
> > Hello Team,
> >
> > I am using keep alive in my app. At session idle
> > to count idle event what should in them
> > session.getBothIdleCount() or session.getReaderIdleCount()
>
> Can you be a bit moe specific about wht you want ?
>
>
> --
> Regards,
> Cordialement,
> Emmanuel Lécharny
> www.iktek.com
>
>

Re: Query regarding keep alive

Posted by Emmanuel Lécharny <el...@gmail.com>.
Le 5/30/13 7:55 AM, Saurav Gulati a écrit :
> Hello Team,
>
> I am using keep alive in my app. At session idle
> to count idle event what should in them
> session.getBothIdleCount() or session.getReaderIdleCount()

Can you be a bit moe specific about wht you want ?


-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com