public class AtomicGauge extends Object implements Gauge
Gauge
THREAD SAFETY - This classes uses AtomicLong under the covers to ensure consistent reads and writes of value
| Modifier and Type | Field and Description |
|---|---|
protected String |
name |
protected AtomicLong |
value |
| Constructor and Description |
|---|
AtomicGauge(String name) |
AtomicGauge(String name,
AtomicLong atomicLongRef)
This constructor takes a reference to an AtomicLong that may be outside this Gauge.
|
AtomicGauge(String name,
long value) |
| Modifier and Type | Method and Description |
|---|---|
long |
addAndGet(long delta)
Adds the delta value to the Gauge and returns the new value.
|
int |
compareTo(Instrument that) |
long |
decrementAndGet()
Decrements one from the Gauge and returns the new value
|
String |
getName() |
long |
getValue() |
long |
incrementAndGet()
Adds one to the Gauge and returns the new value
|
String |
toString() |
protected final AtomicLong value
protected final String name
public AtomicGauge(String name)
public AtomicGauge(String name, long value)
public AtomicGauge(String name, AtomicLong atomicLongRef)
name - the name of the gaugeatomicLongRef - the reference to an AtomicLongpublic String getName()
getName in interface Instrumentpublic long incrementAndGet()
GaugeincrementAndGet in interface Gaugepublic long decrementAndGet()
GaugedecrementAndGet in interface Gaugepublic long addAndGet(long delta)
Gaugepublic long getValue()
getValue in interface Instrumentpublic int compareTo(Instrument that)
compareTo in interface Comparable<Instrument>Copyright © 2016 Atlassian. All rights reserved.