public interface Sessions extends Iterable<ServerSession>
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 ServerSession.publish(String, Object) are effectively no-ops.
| Modifier and Type | Method and Description |
|---|---|
Sessions |
addListener(SessionListener listener)
Adds a listener to the sessions.
|
Sessions |
removeListener(SessionListener listener)
Removes a listener from the sessions.
|
ServerSession |
session(long sessionId)
Returns a session by session ID.
|
forEach, iterator, spliteratorServerSession session(long sessionId)
sessionId - The session ID.null if no session with the given sessionId exists.Sessions addListener(SessionListener listener)
listener - The listener to add.NullPointerException - if the session listener is nullSessions removeListener(SessionListener listener)
listener - The listener to remove.Copyright © 2013–2016. All rights reserved.