Class SessionMgr


  • public class SessionMgr
    extends java.lang.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 Summary

      Fields 
      Modifier and TypeFieldDescription
      static longDEFAULT_DORMANT_TIMEOUT
      Default timeout before an app session is disposed of when no more client sessions are present, default 10 minutes.
      static longDEFAULT_HEARTBEAT_INTERVAL
      Default heartbeat interval in seconds to keep communication link up, default 20 seconds.
      static longDEFAULT_IDLE_TIMEOUT
      Default timeout before a client session is disposed when it has not processes any transactions, default 2 hours.
    • 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.