Class CounterMetric

java.lang.Object
org.elasticsearch.common.metrics.CounterMetric

public final class CounterMetric extends 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 Details

    • CounterMetric

      public CounterMetric()
  • Method Details

    • 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()