Interface Sessions

All Superinterfaces:
Iterable<Session>

public interface Sessions
extends Iterable<Session>
Provides a set of active server sessions.

Server state machines can use the Sessions object to access the list of sessions currently open to the state machine. Session sets are guaranteed to be deterministic. All state machines will see the same set of open sessions at the same point in the log except in cases where a session has already been closed and removed. If a session has already been closed on another server, the session is guaranteed to have been expired on all servers and thus operations like Session.publish(PrimitiveEvent) are effectively no-ops.

  • Method Details

    • getSession

      Session getSession​(long sessionId)
      Returns a session by session ID.
      Parameters:
      sessionId - The session ID.
      Returns:
      The session or null if no session with the given sessionId exists.
    • addListener

      Sessions addListener​(SessionListener listener)
      Adds a listener to the sessions.
      Parameters:
      listener - The listener to add.
      Returns:
      The sessions.
      Throws:
      NullPointerException - if the session listener is null
    • removeListener

      Sessions removeListener​(SessionListener listener)
      Removes a listener from the sessions.
      Parameters:
      listener - The listener to remove.
      Returns:
      The sessions.