T
- The type of the value.public class LastValueTracker<T>
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
LastValueTracker.InstantAndValue<T> |
Constructor and Description |
---|
LastValueTracker() |
Modifier and Type | Method and Description |
---|---|
java.util.Optional<LastValueTracker.InstantAndValue<T>> |
getAndSet(MetricKey metricKey,
java.time.Instant now,
T value)
Return the last instant/value for the given MetricKey, or Optional.empty if there isn't one.
|
java.util.concurrent.atomic.AtomicReference<LastValueTracker.InstantAndValue<T>> |
remove(MetricKey metricKey) |
public java.util.Optional<LastValueTracker.InstantAndValue<T>> getAndSet(MetricKey metricKey, java.time.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 java.util.concurrent.atomic.AtomicReference<LastValueTracker.InstantAndValue<T>> remove(MetricKey metricKey)