Class SimpleCounterSet

java.lang.Object
org.apache.zookeeper.server.metric.Metric
org.apache.zookeeper.server.metric.SimpleCounterSet
All Implemented Interfaces:
CounterSet

public class SimpleCounterSet extends Metric implements CounterSet
Represent a set of counters identified by different keys. The counter is thread-safe
  • Constructor Details

    • SimpleCounterSet

      public SimpleCounterSet(String name)
  • Method Details

    • add

      public void add(String key, long delta)
      Description copied from interface: CounterSet
      Increment the value by a given amount for the given key

      This method is thread safe, The MetricsProvider will take care of synchronization.

      Specified by:
      add in interface CounterSet
      Overrides:
      add in class Metric
      Parameters:
      key - the key to increment the count for the given key
      delta - amount to increment, this cannot be a negative number.
    • reset

      public void reset()
      Overrides:
      reset in class Metric
    • values

      public Map<String,Object> values()
      Specified by:
      values in class Metric