Le 26/03/2018 à 01:55, Juan Palacios a écrit :
> Hi
> I was hoping I could get some support analysing a change I'd like to make
> to our MINA integration.
>
> Our application limits the total number of sessions it will open
> concurrently to keep high load from hurting our performance.
>
> However we've noticed recently that some of our users are configuring
> ControlPersist + KeepAlive settings for their clients. This keeps sessions
> alive for extended periods of time (we've seen sessions going for days).
>
> I was wondering if there was a way of detecting sessions which are
> *only* producing
> keep alive traffic and terminating them after a certain period of time. The
> goal is to prevent these users from exhausting the pool of available
> sessions.
You can set a idle timeout that will trigger an event if a session is
idling for more than a given time, in IoSessionConfig :
/**
* Sets idle time for the specified type of idleness in seconds.
* @param status The status for which we want to set the idle time
(One of READER_IDLE,
* WRITER_IDLE or BOTH_IDLE)
* @param idleTime The time in second to set
*/
void setIdleTime(IdleStatus status, int idleTime);
Then the IoHandler interface has a method allowing you to manage an idle
session :
/**
* Invoked with the related {@link IdleStatus} when a connection
becomes idle.
* This method is not invoked if the transport type is UDP; it's a
known bug,
* and will be fixed in 2.0.
*
* @param session The idling session
* @param status The session's status
* @throws Exception If we get an exception while processing the
idle event
*/
void sessionIdle(IoSession session, IdleStatus status) throws Exception;
This event is generated when a sessin is idling more than the configured
TIEMOUT you set in the config.
--
Emmanuel Lecharny
Symas.com
directory.apache.org