Class SessionMgr

java.lang.Object
com.iizix.comm.session.SessionMgr

public class SessionMgr extends Object
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 Details Link icon

    • DEFAULT_IDLE_TIMEOUT Link icon

      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:
    • DEFAULT_DORMANT_TIMEOUT Link icon

      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:
    • DEFAULT_HEARTBEAT_INTERVAL Link icon

      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:
  • Method Details Link icon

    • getInstance Link icon

      public static SessionMgr getInstance()
      Gets the Session Manager singleton.
      Returns:
      The singleton instance.
    • setup Link icon

      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 Link icon

      public long getHeartBeatInterval()
      Gets the heart-beat interval in milliseconds.
    • getDormantTimeout Link icon

      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 Link icon

      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 Link icon

      public int getMaxTransactionQueue()
      Gets the maximum queued transaction to keep.