Package org.terracotta.statistics
Class SampledStatisticAdapter<T extends java.io.Serializable>
- java.lang.Object
-
- org.terracotta.statistics.SampledStatisticAdapter<T>
-
- All Implemented Interfaces:
SampledStatistic<T>,ValueStatistic<T>
public class SampledStatisticAdapter<T extends java.io.Serializable> extends java.lang.Object implements SampledStatistic<T>
-
-
Field Summary
Fields Modifier and Type Field Description private ValueStatistic<T>statisticprivate java.util.function.LongSuppliertimeSource
-
Constructor Summary
Constructors Modifier Constructor Description privateSampledStatisticAdapter(ValueStatistic<T> statistic, java.util.function.LongSupplier timeSource)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<Sample<T>>history()The history of valuesjava.util.List<Sample<T>>history(long since)The history of values, since a given time in msstatic <T extends java.io.Serializable>
SampledStatistic<T>sample(ValueStatistic<T> accessor, java.util.function.LongSupplier timeSource)StatisticTypetype()Tvalue()
-
-
-
Field Detail
-
timeSource
private final java.util.function.LongSupplier timeSource
-
statistic
private final ValueStatistic<T extends java.io.Serializable> statistic
-
-
Constructor Detail
-
SampledStatisticAdapter
private SampledStatisticAdapter(ValueStatistic<T> statistic, java.util.function.LongSupplier timeSource)
-
-
Method Detail
-
value
public T value()
- Specified by:
valuein interfaceValueStatistic<T extends java.io.Serializable>- Returns:
- The current statistic value
-
history
public java.util.List<Sample<T>> history()
Description copied from interface:SampledStatisticThe history of values- Specified by:
historyin interfaceSampledStatistic<T extends java.io.Serializable>- Returns:
- the list
-
history
public java.util.List<Sample<T>> history(long since)
Description copied from interface:SampledStatisticThe history of values, since a given time in ms- Specified by:
historyin interfaceSampledStatistic<T extends java.io.Serializable>- Parameters:
since- starting point of history in ms- Returns:
- the list
-
type
public StatisticType type()
- Specified by:
typein interfaceValueStatistic<T extends java.io.Serializable>- Returns:
- The statistic type
-
sample
public static <T extends java.io.Serializable> SampledStatistic<T> sample(ValueStatistic<T> accessor, java.util.function.LongSupplier timeSource)
-
-