My goal is to make sure a session is really idle before I do
session.close() on it.
If I session.setWriteTimeout(3) to set timeout to 3 secs.
And no write activity after 3 secs, I expect
session.isIdle((IdleStatus.WRITER_IDLE)
to return true.
Thanks
On 10/24/06, Trustin Lee <[EMAIL PROTECTED]> wrote:
On 10/25/06, Paul Chen <[EMAIL PROTECTED]> wrote:
>
> Hi, folks, I found a weird problem that session.isIdle() always returns
me
> true even though there's no session read/write activitiies at all after
a
> long
> time. My code excerpt is as follows. Thanks for comments.
>
> * In the handler:
>
> public void sessionCreated(IoSession session) throws Exception {
>
> session.setWriteTimeout(3);
> session.setIdleTime(IdleStatus.BOTH_IDLE, 3);
> session.setIdleTime(IdleStatus.WRITER_IDLE, 3);
>
> }
>
> * In a global static session table:
>
> Clean up session when it is done:
>
> ...
>
> if (session.isIdle(IdleStatus.WRITER_IDLE)) {
> // cleanup
> ...
> session.close();
> }
>
> ...
>
>
> But "isIdle()" always returns true even long after client
> received all data.
>
> Is this a bug in Mina or I missed something?
We can say that the session is *still* idle when there has been no I/O
activity since it became idle. The idle status is only cleared when I/O
happens. What's your expected behavior of isIdle then?
Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP key fingerprints:
* E167 E6AF E73A CBCE EE41 4A29 544D DE48 FE95 4E7E
* B693 628E 6047 4F8F CFA4 455E 1C62 A7DC 0255 ECA6