Package com.iizix.comm.session
Class SessionMgr
java.lang.Object
com.iizix.comm.session.SessionMgr
The Session Manager controls the open or dormant sessions and depending on server implementation, has a timer implementation or used the Java EE timers.
- Author:
- Christopher Mindus
- Field SummaryFieldsModifier and TypeFieldDescription- static final longDefault timeout before an app session is disposed of when no more client sessions are present, default 10 minutes.- static final longDefault heartbeat interval in seconds to keep communication link up, default 20 seconds.- static final longDefault timeout before a client session is disposed when it has not processes any transactions, default 2 hours.
- Method SummaryModifier and TypeMethodDescription- longGets the time-out of dormant sessions (paused/broken).- longGets the heart-beat interval in milliseconds.- longGets the idle time-out of session.- static SessionMgrGets the Session Manager singleton.- intGets the maximum queued transaction to keep.- void- setup- (long dormatTimeout, long idleTimeout, long heartBeatInterval) Assigns the timeouts and heartbeat interval.
- Field Details- DEFAULT_IDLE_TIMEOUTpublic static final long DEFAULT_IDLE_TIMEOUTDefault timeout before a client session is disposed when it has not processes any transactions, default 2 hours. Value in milliseconds.- See Also:
 
- DEFAULT_DORMANT_TIMEOUTpublic static final long DEFAULT_DORMANT_TIMEOUTDefault timeout before an app session is disposed of when no more client sessions are present, default 10 minutes. Value in milliseconds.- See Also:
 
- DEFAULT_HEARTBEAT_INTERVALpublic static final long DEFAULT_HEARTBEAT_INTERVALDefault heartbeat interval in seconds to keep communication link up, default 20 seconds. Value in milliseconds.- See Also:
 
 
- Method Details- getInstanceGets the Session Manager singleton.- Returns:
- The singleton instance.
 
- setuppublic void setup- (long dormatTimeout, long idleTimeout, long heartBeatInterval) Assigns the timeouts and heartbeat interval. The new settings are taken into account directly. All values are in milliseconds.- Parameters:
- dormatTimeout- Timeout of dormant sessions (paused/broken).
- idleTimeout- Idle timeout of session.
- heartBeatInterval- Heartbeat interval.
- Throws:
- IllegalArgumentException- If the values are out of range.
 
- getHeartBeatIntervalpublic long getHeartBeatInterval()Gets the heart-beat interval in milliseconds.
- getDormantTimeoutpublic long getDormantTimeout()Gets the time-out of dormant sessions (paused/broken).- This value is used to check if dormant sessions is allowed or not. - Returns:
- Time-out in milliseconds, -1L for indefinite, zero for not allowed (dormant sessions not allowed).
 
- getIdleTimeoutpublic long getIdleTimeout()Gets the idle time-out of session. The idle-timeout includes dormant session time-out, i.e. when this time-out is reached, the session is disposed of.- Returns:
- Timeout in milliseconds, -1 for indefinite (i.e. no time-out).
 
- getMaxTransactionQueuepublic int getMaxTransactionQueue()Gets the maximum queued transaction to keep.