Class ClusterStatusTracker
java.lang.Object
org.apache.hadoop.hbase.zookeeper.ZKListener
org.apache.hadoop.hbase.zookeeper.ZKNodeTracker
org.apache.hadoop.hbase.zookeeper.ClusterStatusTracker
Tracker on cluster settings up in zookeeper. This is not related to
ClusterMetrics
. That class is a data structure that holds
snapshot of current view on cluster. This class is about tracking cluster attributes up in
zookeeper.-
Field Summary
Fields inherited from class org.apache.hadoop.hbase.zookeeper.ZKNodeTracker
abortable, node
Fields inherited from class org.apache.hadoop.hbase.zookeeper.ZKListener
watcher
-
Constructor Summary
ConstructorDescriptionClusterStatusTracker
(ZKWatcher watcher, Abortable abortable) Creates a cluster status tracker. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Checks if cluster is up.void
Sets the cluster as down by deleting the znode.void
Sets the cluster as up.(package private) static byte[]
Returns Content of the clusterup znode as a serialized pb with the pb magic as prefix.Methods inherited from class org.apache.hadoop.hbase.zookeeper.ZKNodeTracker
blockUntilAvailable, blockUntilAvailable, checkIfBaseNodeAvailable, getData, getNode, nodeCreated, nodeDataChanged, nodeDeleted, postStart, start, stop, toString
Methods inherited from class org.apache.hadoop.hbase.zookeeper.ZKListener
getWatcher, nodeChildrenChanged
-
Field Details
-
LOG
-
-
Constructor Details
-
ClusterStatusTracker
Creates a cluster status tracker.After construction, use
ZKNodeTracker.start()
to kick off tracking.- Parameters:
watcher
- reference to theZKWatcher
which also contains configuration and constantsabortable
- used to abort if a fatal error occurs
-
-
Method Details
-
isClusterUp
Checks if cluster is up.- Returns:
- true if the cluster up ('shutdown' is its name up in zk) znode exists with data, false if not
-
setClusterUp
Sets the cluster as up.- Throws:
org.apache.zookeeper.KeeperException
- unexpected zk exception
-
setClusterDown
Sets the cluster as down by deleting the znode.- Throws:
org.apache.zookeeper.KeeperException
- unexpected zk exception
-
toByteArray
Returns Content of the clusterup znode as a serialized pb with the pb magic as prefix.
-