@InterfaceAudience.Private public class ClusterStatusTracker extends ZKNodeTracker
ClusterStatus
. That class is a data structure that holds snapshot
of current view on cluster. This class is about tracking cluster attributes up in zookeeper.Modifier and Type | Field and Description |
---|---|
private static org.slf4j.Logger |
LOG |
abortable, node
watcher
Constructor and Description |
---|
ClusterStatusTracker(ZKWatcher watcher,
Abortable abortable)
Creates a cluster status tracker.
|
Modifier and Type | Method and Description |
---|---|
boolean |
isClusterUp()
Checks if cluster is up.
|
void |
setClusterDown()
Sets the cluster as down by deleting the znode.
|
void |
setClusterUp()
Sets the cluster as up.
|
(package private) static byte[] |
toByteArray()
Returns Content of the clusterup znode as a serialized pb with the pb magic as prefix.
|
blockUntilAvailable, blockUntilAvailable, checkIfBaseNodeAvailable, getData, getNode, nodeCreated, nodeDataChanged, nodeDeleted, postStart, start, stop, toString
getWatcher, nodeChildrenChanged
private static final org.slf4j.Logger LOG
public ClusterStatusTracker(ZKWatcher watcher, Abortable abortable)
After construction, use ZKNodeTracker.start()
to kick off tracking.
watcher
- reference to the ZKWatcher
which also contains configuration and
constantsabortable
- used to abort if a fatal error occurspublic boolean isClusterUp()
public void setClusterUp() throws org.apache.zookeeper.KeeperException
org.apache.zookeeper.KeeperException
- unexpected zk exceptionpublic void setClusterDown() throws org.apache.zookeeper.KeeperException
org.apache.zookeeper.KeeperException
- unexpected zk exceptionstatic byte[] toByteArray()
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.