directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Trustin Lee (JIRA)" <>
Subject [jira] Resolved: (DIRMINA-82) IdleSession reported only once per IO
Date Wed, 17 Aug 2005 02:27:54 GMT
     [ ]
Trustin Lee resolved DIRMINA-82:

    Resolution: Won't Fix

It is a normal behavior, not a bug.  MINA checks session idleness every seconds, and fires
sessionIdle event if:

* if the session is considered idle, and
* if sessionIdle event is not fired yet.

So if you didn't write/read any message since sessionIdle event is fired, sessionIdle event
is not fired again.  You need to do some I/O to activate the event again.  It is to prevent
sessionIdle events from being fired too frequently such as every seconds.

If you want sessionIdle event get fired periodically, you'll have to use Timer or OpenSymphony
Quartz.  Please let me know if you have any better idea retaining current behavior.

> IdleSession reported only once per IO
> -------------------------------------
>          Key: DIRMINA-82
>          URL:
>      Project: Directory MINA
>         Type: Bug
>     Versions: 0.7.3
>     Reporter: Ash Hornbeck
>     Assignee: Trustin Lee
>      Fix For: 0.7.4

> IdleSession reported only once per IO 
> For example, if I do something like this
> // session is a ProtocolSession from an IoProtocolConnector
> session.getConfig().setIdleTime(IdleStatus.BOTH_IDLE,30 ); 
> and a connection is idle for 301 seconds (both read and write), I expect roughly 10 IdleStatus.BOTH_IDLE
events.  In 0.7.3 it will only be fired once and only once until IO occurs.  It looks like
it is due to the way idle sessions are detected in the following:
>    private void notifyIdleSession0( SocketSession session, long currentTime,
>                                     long idleTime, IdleStatus status,
>                                     long lastIoTime )
>     {
>         if( idleTime > 0 && !session.isIdle( status ) && lastIoTime
!= 0
>             && ( currentTime - lastIoTime ) >= idleTime )
>         {
>             session.setIdle( status, true );
>             session.getManagerFilterChain().sessionIdle( session, status );
>         }
>     }
> Please correct me if I am wrong but it looks as though the statement in the if clause,
!session.isIdle( status ), is used to detect if the idle event has been fired.  This prevents
multiple session idle events from being fired due to selector timeouts in
> The problem is that using this method there is no way to know that the last idle event
was fired greater than idle timeout seconds ago and another event needs to be fired.
> My suggestion is to add lastIdleEventForBoth/Read/Write and replace !session.isIdle(
status) with (currentTime ? lastIdleEvent) >= idleTime.

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:

View raw message