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

org.apache.zookeeper.server.metric

## Class SimpleCounter

- java.lang.Object
- - org.apache.zookeeper.server.metric.Metric
  - - org.apache.zookeeper.server.metric.SimpleCounter

- All Implemented Interfaces:
    Counter

      public class SimpleCounter
      extends Metric
      implements Counter

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SimpleCounter(String name)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(long value)` Increment the value by a given amount.
    `long` | `get()` Get the current value held by the counter.
    `void` | `reset()`
    `Map<String,Object>` | `values()`

    - ### Methods inherited from class org.apache.zookeeper.server.metric.Metric

      `add, add`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.apache.zookeeper.metrics.Counter

      `inc`

- - ### Constructor Detail

    - #### SimpleCounter

          public SimpleCounter(String name)

  - ### Method Detail

    - #### add

          public void add(long value)

      Description copied from interface: `Counter`
      Increment the value by a given amount.

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

      Specified by:
        `add` in interface `Counter`
      Overrides:
        `add` in class `Metric`
      Parameters:
        `value` - amount to increment, this cannot be a negative number.

    - #### reset

          public void reset()

      Overrides:
        `reset` in class `Metric`

    - #### get

          public long get()

      Description copied from interface: `Counter`
      Get the current value held by the counter.

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

      Specified by:
        `get` in interface `Counter`
      Returns:
        the current value

    - #### values

          public Map<String,Object> values()

      Specified by:
        `values` in class `Metric`

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