![JAR search and dependency download from the Maven repository](/logo.png)
com.codahale.metrics.CachedGauge Maven / Gradle / Ivy
The newest version!
package com.codahale.metrics;
import java.util.concurrent.TimeUnit;
import static java.util.Objects.requireNonNull;
@Deprecated
public abstract class CachedGauge implements Gauge {
private final io.dropwizard.metrics5.CachedGauge gauge;
public CachedGauge(io.dropwizard.metrics5.CachedGauge gauge) {
this.gauge = requireNonNull(gauge);
}
protected CachedGauge(long timeout, TimeUnit timeoutUnit) {
final CachedGauge original = this;
gauge = new io.dropwizard.metrics5.CachedGauge(timeout, timeoutUnit) {
@Override
protected T loadValue() {
return original.loadValue();
}
};
}
protected CachedGauge(Clock clock, long timeout, TimeUnit timeoutUnit) {
final CachedGauge original = this;
gauge = new io.dropwizard.metrics5.CachedGauge(clock.getDelegate(), timeout, timeoutUnit) {
@Override
protected T loadValue() {
return original.loadValue();
}
};
}
protected abstract T loadValue();
public T getValue() {
return gauge.getValue();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy