Class DefaultCounter

java.lang.Object
org.apache.iceberg.metrics.DefaultCounter
All Implemented Interfaces:
Counter

public class DefaultCounter extends Object implements Counter
A default Counter implementation that uses an AtomicLong to count events.
  • Field Details

    • NOOP

      public static final Counter NOOP
  • Method Details

    • increment

      public void increment()
      Description copied from interface: Counter
      Increment the counter by 1.
      Specified by:
      increment in interface Counter
    • increment

      public void increment(long amount)
      Description copied from interface: Counter
      Increment the counter by the provided amount.

      Implementations may skip the overflow check for better write throughput.

      Specified by:
      increment in interface Counter
      Parameters:
      amount - to be incremented.
    • value

      public long value()
      Description copied from interface: Counter
      Reports the current count.
      Specified by:
      value in interface Counter
      Returns:
      The current count.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • unit

      public MetricsContext.Unit unit()
      Description copied from interface: Counter
      The unit of the counter.
      Specified by:
      unit in interface Counter
      Returns:
      The unit of the counter.