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 Summary
Modifier and TypeFieldDescriptionstatic final long
Default timeout before an app session is disposed of when no more client sessions are present, default 10 minutes.static final long
Default heartbeat interval in seconds to keep communication link up, default 20 seconds.static final long
Default timeout before a client session is disposed when it has not processes any transactions, default 2 hours.Method Summary
Modifier and TypeMethodDescriptionlong
Gets the time-out of dormant sessions (paused/broken).long
Gets the heart-beat interval in milliseconds.long
Gets the idle time-out of session.static SessionMgr
Gets the Session Manager singleton.int
Gets the maximum queued transaction to keep.void
setup
(long dormatTimeout, long idleTimeout, long heartBeatInterval) Assigns the timeouts and heartbeat interval.
Field Details
DEFAULT_IDLE_TIMEOUT
public 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_TIMEOUT
public 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_INTERVAL
public 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
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:
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.