T - The type of the value.public class LastValueTracker<T> extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
LastValueTracker.InstantAndValue<T> |
| Constructor and Description |
|---|
LastValueTracker() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(MetricKey metricKey) |
Optional<LastValueTracker.InstantAndValue<T>> |
getAndSet(MetricKey metricKey,
Instant now,
T value)
Return the last instant/value for the given MetricKey, or Optional.empty if there isn't one.
|
AtomicReference<LastValueTracker.InstantAndValue<T>> |
remove(MetricKey metricKey) |
public Optional<LastValueTracker.InstantAndValue<T>> getAndSet(MetricKey metricKey, Instant now, T value)
metricKey - the key for which to calculate a getAndSet.now - the timestamp for the new value.value - the current value.Optional.empty()public AtomicReference<LastValueTracker.InstantAndValue<T>> remove(MetricKey metricKey)
public boolean contains(MetricKey metricKey)