Interface Sampler<T>
-
- All Superinterfaces:
JsonMonitorable
- All Known Implementing Classes:
BlockingSampler,InaccurateSampler
public interface Sampler<T> extends JsonMonitorable
Allows sampling values from a stream- Author:
- Eyal Schneider
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Collection<T>getSnapshot()booleannewValue(T value)Notifies about a new valueintsize()-
Methods inherited from interface org.pipecraft.infra.monitoring.JsonMonitorable
getChildren, getFullMetrics, getOwnMetrics
-
-
-
-
Method Detail
-
newValue
boolean newValue(T value)
Notifies about a new value- Parameters:
value- The new value.- Returns:
- true iff the new value has been recorded in the sample.
-
getSnapshot
Collection<T> getSnapshot()
- Returns:
- The collection of all values currently stored in the sampler. Consistency is not guaranteed (i.e. this is not necessarily a real snapshot of the inner collection). Note that null values or unrecorded values are returned as nulls.
-
size
int size()
- Returns:
- The capacity of the sampler
-
-