public enum ConnectionState extends java.lang.Enum<ConnectionState>
| Enum Constant | Description |
|---|---|
CONNECTED |
Sent for the first successful connection to the server.
|
LOST |
Curator will set the LOST state when it believes that the ZooKeeper session
has expired.
|
READ_ONLY |
The connection has gone into read-only mode.
|
RECONNECTED |
A suspended, lost, or read-only connection has been re-established
|
SUSPENDED |
There has been a loss of connection.
|
| Modifier and Type | Method | Description |
|---|---|---|
abstract boolean |
isConnected() |
Check if this state indicates that Curator has a connection to ZooKeeper
|
static ConnectionState |
valueOf(java.lang.String name) |
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.
|
public static final ConnectionState CONNECTED
public static final ConnectionState SUSPENDED
public static final ConnectionState RECONNECTED
public static final ConnectionState 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 or KeeperException.Code.SESSIONEXPIRED;
b) Curator closes the internally managed ZooKeeper instance; c) The session timeout
elapses during a network partition.
NOTE: see CuratorFrameworkFactory.Builder.connectionHandlingPolicy(ConnectionHandlingPolicy) for an important note about a
change in meaning to LOST since 3.0.0
public static final ConnectionState READ_ONLY
CuratorFrameworkFactory.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.public static ConnectionState[] values()
for (ConnectionState c : ConnectionState.values()) System.out.println(c);
public static ConnectionState valueOf(java.lang.String name)
name - the name of the enum constant to be returned.java.lang.IllegalArgumentException - if this enum type has no constant with the specified namejava.lang.NullPointerException - if the argument is nullpublic abstract boolean isConnected()
Copyright © 2011–2018 The Apache Software Foundation. All rights reserved.