Interface ISessionRepository


public interface ISessionRepository

Session repository to create, destroy and find sessions.

Since:
9.3
API:
This is a public API.
  • Method Details

    • all

      List<ISession> all()
      Gets all sessions of the security context / application. In a cluster environment returns only the sessions of the local cluster node. To get information of session on all cluster nodes use clusterSnapshot()
      Returns:
      sessions
      API:
      This public API is available in Java.
      Security:
      SESSION OWNS SessionReadAll PERMISSION OR OWNS SessionReadAll@SYSTEM PERMISSION
    • ofUser

      List<ISession> ofUser(IUser user)
      Gets all sessions of the given user. In a cluster environment returns only the sessions of the user on the local cluster node.
      Returns:
      sessions of the given user
      API:
      This public API is available in Java.
      Security:
      SESSION OWNS SessionReadAll PERMISSION OR OWNS SessionReadAll@SYSTEM PERMISSION
    • count

      long count()
      Get count of all sessions of this local running engine.
      Returns:
      count of sessions (without system user session)
      API:
      This public API is available in Java.
    • find

      ISession find(int sessionIdentifier)
      Finds a session by its identifier
      Parameters:
      sessionIdentifier - session identifier
      Returns:
      session or null
      API:
      This public API is available in Java.
      Security:
      SESSION OWNS SessionReadAll PERMISSION OR OWNS SessionReadAll@SYSTEM PERMISSION
    • systemUser

      ISession systemUser()
      Gets the session of the system user
      Returns:
      system user session
      API:
      This public API is available in Java.
      Security:
      SESSION OWNS SessionReadAll PERMISSION OR OWNS SessionReadAll@SYSTEM PERMISSION
    • current

      ISession current()
      Gets the current session. Gets the current session associated to the current thread
      Returns:
      current session or null if current thread has no session associated
      See Also:
      API:
      This public API is available in Java.
    • destroy

      default void destroy(int sessionIdentifier)
      Destroys a session. Prefer using destroy(int, String)I
      Parameters:
      sessionIdentifier - session identifier
      See Also:
      • destroy(int, String)
      API:
      This public API is available in Java.
    • create

      ISession create()
      Creates a new session. Prefer using create(String).
      Returns:
      new session
      See Also:
      • create(String)
      API:
      This public API is available in Java.
    • clusterSnapshot

      ClusterSessionsSnapshot clusterSnapshot()
      Calls clusterSnapshot(long) with the default value of maxAge=1000 (1 second)
      Returns:
      a cluster session snapshot. Never null
      API:
      This public API is available in Java.
    • clusterSnapshot

      ClusterSessionsSnapshot clusterSnapshot(long maxAge)
      Returns a snapshot containing information of all sessions at the time this method was invoked. If there is only one cluster node the ClusterSessionsSnapshot contains the same information which can be fetched with all(). If there are multiple cluster nodes the ClusterSessionsSnapshot contains as well information about sessions on other nodes. The parameter maxAge controls how old the ClusterSessionsSnapshot can be. For example with maxAge=5000 the ClusterSessionsSnapshot is maximal 5 seconds old. The longer the maxAge is the less network traffic is caused.
      Parameters:
      maxAge - in milliSeconds
      Returns:
      a cluster session snapshot. Never null
      API:
      This public API is available in Java.