Interface Counter

All Known Implementing Classes:
SimpleCounter

public interface Counter
A counter refers to a value which can only increase. Usually the value is reset when the process starts.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(long delta)
    Increment the value by a given amount.
    long
    get()
    Get the current value held by the counter.
    default void
    inc()
    Increment the value by one.
  • Method Details

    • inc

      default void inc()
      Increment the value by one.

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

    • add

      void add(long delta)
      Increment the value by a given amount.

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

      Parameters:
      delta - amount to increment, this cannot be a negative number.
    • get

      long get()
      Get the current value held by the counter.

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

      Returns:
      the current value