# 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 Summary

Fields
Modifier and Type
Field
Description
`static final WatchStats`
`NONE`
Stats that have no watchers attached.

## Method Summary

Modifier and Type
Method
Description
`WatchStats`
`addMode(WatcherMode mode)`
Compute stats after given mode attached to node.
`boolean`
`hasMode(WatcherMode mode)`
Check whether given mode is attached to this node.
`WatchStats`
`removeMode(WatcherMode mode)`
Compute stats after given mode removed from node.

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## 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.