se.l4.vibe.probes.AbstractSampledProbe Maven / Gradle / Ivy
package se.l4.vibe.probes;
/**
* Abstract implementation of {@link SampledProbe}. This class helps with the
* implementation of {@link #read()} which always return the last value of
* {@link #sample()}.
*
* @author Andreas Holstenson
*
* @param
*/
public abstract class AbstractSampledProbe
implements SampledProbe
{
protected T value;
public AbstractSampledProbe()
{
}
@Override
public final T read()
{
return value;
}
@Override
public T sample()
{
return (value = sample0());
}
/**
* Perform the real sampling.
*
* @return
*/
protected abstract T sample0();
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy