Class WatchStats

java.lang.Object
org.apache.zookeeper.server.watch.WatchStats

public final class WatchStats extends Object
Statistics for multiple different watches on one node.
  • Field Details

    • NONE

      public static final WatchStats NONE
      Stats that have no watchers attached.

      This could be used as start point to compute new stats using addMode(WatcherMode).

  • Method Details

    • addMode

      public WatchStats addMode(WatcherMode mode)
      Compute stats after given mode attached to node.
      Parameters:
      mode - watcher mode
      Returns:
      a new stats if given mode is not attached to this node before, otherwise old stats
    • removeMode

      public WatchStats removeMode(WatcherMode mode)
      Compute stats after given mode removed from node.
      Parameters:
      mode - watcher mode
      Returns:
      null if given mode is the last attached mode, otherwise a new stats
    • hasMode

      public boolean hasMode(WatcherMode mode)
      Check whether given mode is attached to this node.
      Parameters:
      mode - watcher mode
      Returns:
      true if given mode is attached to this node.