Class ClusterStatusTracker


@Private public class ClusterStatusTracker extends ZKNodeTracker
Tracker on cluster settings up in zookeeper. This is not related to 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.
  • Field Details

    • LOG

      private static final org.slf4j.Logger LOG
  • Constructor Details

    • ClusterStatusTracker

      public ClusterStatusTracker(ZKWatcher watcher, Abortable abortable)
      Creates a cluster status tracker.

      After construction, use ZKNodeTracker.start() to kick off tracking.

      Parameters:
      watcher - reference to the ZKWatcher which also contains configuration and constants
      abortable - used to abort if a fatal error occurs
  • Method Details

    • isClusterUp

      public boolean 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

      public void setClusterUp() throws org.apache.zookeeper.KeeperException
      Sets the cluster as up.
      Throws:
      org.apache.zookeeper.KeeperException - unexpected zk exception
    • setClusterDown

      public void setClusterDown() throws org.apache.zookeeper.KeeperException
      Sets the cluster as down by deleting the znode.
      Throws:
      org.apache.zookeeper.KeeperException - unexpected zk exception
    • toByteArray

      static byte[] toByteArray()
      Returns Content of the clusterup znode as a serialized pb with the pb magic as prefix.