Package com.iizix.comm.session
Class SessionMgr
- java.lang.Object
- com.iizix.comm.session.SessionMgr
 
- public class SessionMgr extends java.lang.ObjectThe 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 Summary- Fields - Modifier and Type - Field - Description - static long- DEFAULT_DORMANT_TIMEOUTDefault timeout before an app session is disposed of when no more client sessions are present, default 10 minutes.- static long- DEFAULT_HEARTBEAT_INTERVALDefault heartbeat interval in seconds to keep communication link up, default 20 seconds.- static long- DEFAULT_IDLE_TIMEOUTDefault timeout before a client session is disposed when it has not processes any transactions, default 2 hours.
 - Method Summary- All Methods Static Methods Instance Methods Concrete Methods - Modifier and Type - Method - Description - long- getDormantTimeout()Gets the time-out of dormant sessions (paused/broken).- long- getHeartBeatInterval()Gets the heart-beat interval in milliseconds.- long- getIdleTimeout()Gets the idle time-out of session.- static SessionMgr- getInstance()Gets the Session Manager singleton.- int- getMaxTransactionQueue()Gets the maximum queued transaction to keep.- void- setup(long dormatTimeout, long idleTimeout, long heartBeatInterval)Assigns the timeouts and heartbeat interval.
 
- Field Detail- DEFAULT_IDLE_TIMEOUT- public static final long DEFAULT_IDLE_TIMEOUT Default timeout before a client session is disposed when it has not processes any transactions, default 2 hours. Value in milliseconds.- See Also:
- Constant Field Values
 
 - DEFAULT_DORMANT_TIMEOUT- public static final long DEFAULT_DORMANT_TIMEOUT Default timeout before an app session is disposed of when no more client sessions are present, default 10 minutes. Value in milliseconds.- See Also:
- Constant Field Values
 
 - DEFAULT_HEARTBEAT_INTERVAL- public static final long DEFAULT_HEARTBEAT_INTERVAL Default heartbeat interval in seconds to keep communication link up, default 20 seconds. Value in milliseconds.- See Also:
- Constant Field Values
 
 
 - Method Detail- getInstance- public static SessionMgr getInstance() Gets the Session Manager singleton.- Returns:
- The singleton instance.
 
 - setup- public 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:
- java.lang.IllegalArgumentException- If the values are out of range.
 
 - getHeartBeatInterval- public long getHeartBeatInterval() Gets the heart-beat interval in milliseconds.
 - getDormantTimeout- public 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).
 
 - getIdleTimeout- public 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).
 
 - getMaxTransactionQueue- public int getMaxTransactionQueue() Gets the maximum queued transaction to keep.