Some thoughts about how to manage Idle sessions :
In order to manage idle sessions, we should use a separated thread which
will check periodically that the session has been used or not. We use a
boolean flag which is reset when we read of write on this session, and
switch to true when we check the session idleness : if the flag is
already true, that means the session has been idle for at least one period.
The thread will be wake up after having slept for the defined period
(configurable globally), and will check every registered sessions.
The flag is named isIdle. It's an AtomicBoolean.
Note : if we want to manage different idle times for different sessions
we need to compute the sleep period for all the followed sessions, and
also add a map of sessions to check accordingly to the periods. IMO,
it's a bit over killing atm.
Q: should we manage two different IDLE states ? One for READ nod one for
WRITE ? Not sure it makes sense...
--
Regards,
Cordialement,
Emmanuel Lécharny
www.nextury.com