Also note that we can get idling event for
- read
- write
- both
Ie if a session has not written for a specific period of time, an idle
event will be generated and transmitted for WRITE, and not for READ.
Also note that the event is at least generated once a second, but not
necessarily transmitted, as the session can be configured to propagate
the even less frequently:
session.getConfig().setIdleTime(IdleStatus.BOTH_IDLE, 10);
will check the session idle state for READ and WRITE every second *but*
will propagate an idling event if the session has been idling for at
least 10 seconds.
On 07/03/2022 17:35, Emmanuel Lécharny wrote:
Hi Marc,
this is probably a bit overkilling, especially if you manage many sessions.
A better solution would be to modify the Handler to catch the
sessionIdle event and check for how long the session was idling (the
event will be received every second)
On 07/03/2022 16:28, Marc Boorshtein wrote:
Closing the loop, and hoping for a logic check to make sure my
thinking is correct. I was able to make this work by:
1. Creating an IoServiceListener on my acceptor
2. The IoServiceListener creates a Thread that iterates over all of
the IoSessions in the ManagedSessions map
if an IoSession.getLastIoTime() is greater then a specified time
period old, call session.closeNow()
3. in the IoServiceListener, when the service is destroyed, shut down
the idle check thread.
Experimentally, this solution is working well. But I wanted to see if
you had any feedback or something I was missing?
Thanks
Marc
On Fri, Mar 4, 2022 at 3:34 PM Marc Boorshtein <mboorsht...@gmail.com
<mailto:mboorsht...@gmail.com>> wrote:
Sounds quite a good feature to me.
Thanks for the detailed explanation. Am I able to implement this
without having to make a feature change to Mina? If you pointed me
in the right direction I'm sure I can figure it out but I really
don't know where to start.
Thanks
Marc
--
*Emmanuel Lécharny - CTO* 205 Promenade des Anglais – 06200 NICE
T. +33 (0)4 89 97 36 50
P. +33 (0)6 08 33 32 61
emmanuel.lecha...@busit.com https://www.busit.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@mina.apache.org
For additional commands, e-mail: users-h...@mina.apache.org