Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.

public final class Counter

  1. Object
  2. Instrument
  3. Counter

A count that only goes up – requests served, jobs run, errors seen. Exported as a cumulative monotonic sum.

Recording is one atomic add: no lock, no allocation.

Methods

public void increment()Adds one.
public void add(long amount)Adds amount.
public long get()
public List points()The current points, each a map with attributes (a map, possibly empty) and either value or, for a histogram, count, sum, min, max, bounds and buckets.

Inherited fields

Inherited methods

Method details

increment

public void increment()
Adds one.

add

public void add(long amount)
Adds amount. A counter refuses a negative amount, since a cumulative monotonic sum that falls reads as a reset to every backend; an up-down counter takes either sign.

get

public long get()

points

public List points()
The current points, each a map with attributes (a map, possibly empty) and either value or, for a histogram, count, sum, min, max, bounds and buckets.