Class CounterMetric


  • public final class CounterMetric
    extends java.lang.Object
    A CounterMetric is used to track the number of completed and outstanding items, for example, the number of executed refreshes, the currently used memory by indexing, the current pending search requests. In both cases, the current count() is always non-negative.
    • Constructor Summary

      Constructors 
      Constructor Description
      CounterMetric()  
    • Method Summary

      Modifier and Type Method Description
      long count()
      Returns the current count of this metric.
      void dec()  
      void dec​(long n)  
      void inc()  
      void inc​(long n)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CounterMetric

        public CounterMetric()
    • Method Detail

      • inc

        public void inc()
      • inc

        public void inc​(long n)
      • dec

        public void dec()
      • dec

        public void dec​(long n)
      • count

        public long count()
        Returns the current count of this metric. The returned value is always non-negative.

        As this metric is implemented using a LongAdder, the returned value is NOT an atomic snapshot; invocation in the absence of concurrent updates returns an accurate result, but concurrent updates that occur while the sum is being calculated might not be incorporated.

        See Also:
        LongAdder.sum()