Enum ConnectionState
- All Implemented Interfaces:
Serializable
,Comparable<ConnectionState>
,java.lang.constant.Constable
Represents state changes in the connection to ZK
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionSent for the first successful connection to the server.Curator will set the LOST state when it believes that the ZooKeeper session has expired.The connection has gone into read-only mode.A suspended, lost, or read-only connection has been re-establishedThere has been a loss of connection. -
Method Summary
Modifier and TypeMethodDescriptionabstract boolean
Check if this state indicates that Curator has a connection to ZooKeeperstatic ConnectionState
Returns the enum constant of this type with the specified name.static ConnectionState[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
CONNECTED
Sent for the first successful connection to the server. NOTE: You will only get one of these messages for any CuratorFramework instance. -
SUSPENDED
There has been a loss of connection. Leaders, locks, etc. should suspend until the connection is re-established. -
RECONNECTED
A suspended, lost, or read-only connection has been re-established -
LOST
Curator will set the LOST state when it believes that the ZooKeeper session has expired. ZooKeeper connections have a session. When the session expires, clients must take appropriate action. In Curator, this is complicated by the fact that Curator internally manages the ZooKeeper connection. Curator will set the LOST state when any of the following occurs: a) ZooKeeper returns a
Watcher.Event.KeeperState.Expired
orKeeperException.Code.SESSIONEXPIRED
; b) Curator closes the internally managed ZooKeeper instance; c) The session timeout elapses during a network partition. -
READ_ONLY
The connection has gone into read-only mode. This can only happen if you pass true forCuratorFrameworkFactory.Builder.canBeReadOnly()
. See the ZooKeeper doc regarding read only connections: http://wiki.apache.org/hadoop/ZooKeeper/GSoCReadOnlyMode. The connection will remain in read only mode until another state change is sent.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
isConnected
public abstract boolean isConnected()Check if this state indicates that Curator has a connection to ZooKeeper- Returns:
- True if connected, false otherwise
-