public static enum Session.State extends Enum<Session.State>
Throughout the lifetime of a session, the session may change state as a result of communication or the lack thereof between the client and the cluster. See the specific states for more documentation.
| Enum Constant and Description |
|---|
CLOSED
Indicates that the session has been closed.
|
EXPIRED
Indicates that the session is expired.
|
OPEN
Indicates that the session is connected and open.
|
UNSTABLE
Indicates that the session in an unstable state and may or may not be
EXPIRED. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
active()
Returns a boolean value indicating whether the state is an active state.
|
static Session.State |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static Session.State[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final Session.State OPEN
This is the initial state of a session upon registration. Once the session is registered with the cluster,
the session's state will be OPEN and will remain open so long as the client is able to communicate
with the cluster to keep its session alive.
Clients withe a session in the OPEN state can be assumed to be operating normally and are guaranteed
to benefit from linearizable reads and writes.
public static final Session.State UNSTABLE
EXPIRED.
The unstable state is indicative of a state in which a client is unable to communicate with the cluster and
therefore cannot determine whether its session is or is not expired. Until the client is able to re-establish
communication with the cluster, its session will remain in this state. While in the UNSTABLE state,
users of the client should assume that the session may have been expired and that other clients may react
to the client having been expired while in the unstable state.
Commands submitted or completed in the UNSTABLE state may not be linearizable. An unstable session
may be expired and a client may have to resubmit associated commands once a new session in registered. This
can lead to duplicate commands being applied to servers state machines, thus breaking linearizability.
Once the client is able to re-establish communication with the cluster again it will determine whether the
session is still active or indeed has been expired. The session will either transition back to the
OPEN state or EXPIRED based on feedback from the cluster. Only the cluster can explicitly
expire a session.
public static final Session.State EXPIRED
Once an UNSTABLE client re-establishes communication with the cluster, the cluster may indicate to
the client that its session has been expired. In that case, the client may no longer submit operations under
the expired session and must register a new session to continue operating on server state machines.
When a client's session is expired, commands submitted under the expired session that have not yet been completed may or may not be applied to server state machines. Linearizability is guaranteed only within the context of a session, and so linearizability may be broken if operations are resubmitted across sessions.
public static final Session.State CLOSED
This state indicates that the client's session was explicitly unregistered and the session was closed safely.
public static Session.State[] values()
for (Session.State c : Session.State.values()) System.out.println(c);
public static Session.State valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic boolean active()
Sessions can only submit commands and receive events while in an active state.
Copyright © 2013–2017. All rights reserved.