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

      Constructors 
      Constructor Description
      SimpleCounterSet​(java.lang.String name)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(java.lang.String key, long delta)
      Increment the value by a given amount for the given key
      void reset()  
      java.util.Map<java.lang.String,​java.lang.Object> values()  
      • Methods inherited from class org.apache.zookeeper.server.metric.Metric

        add, add
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.apache.zookeeper.metrics.CounterSet

        inc
    • Constructor Detail

      • SimpleCounterSet

        public SimpleCounterSet​(java.lang.String name)
    • Method Detail

      • add

        public void add​(java.lang.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 java.util.Map<java.lang.String,​java.lang.Object> values()
        Specified by:
        values in class Metric