Counter (Apache ZooKeeper - Server 3.7.0 API)
Date: 2021-03-17

org.apache.zookeeper.metrics

## 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

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and 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 Detail

    - #### 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

Copyright © 2008–2021 The Apache Software Foundation. All rights reserved.