T
- type of the input valuesV
- type of the output valuespublic class CountAggregatingStatistic<T,V> extends java.lang.Object implements UnweightedSampleCollector<T>
CountAggregatingStatistic
aggregates a fixed number n of values with
the help of an Aggregator
. Calls of the method
update(Object)
are counted. Upon each n'th call of
update(Object)
, the aggregated value is written to the backing
statistic and the aggregator is reset.
Implements the interface UnweightedSampleCollector
, so that it can be used
as a replacement for a normal statistic in any meter.
The type of input and output can be different, as aggregation may convert the type. Example: the average of long values can be returned as double.
Constructor and Description |
---|
CountAggregatingStatistic(UnweightedSampleCollector<V> baseStat,
int numberOfValuesToAggregate,
Aggregator<? super T,? extends V> aggregator) |
Modifier and Type | Method and Description |
---|---|
void |
update(T value) |
public CountAggregatingStatistic(UnweightedSampleCollector<V> baseStat, int numberOfValuesToAggregate, Aggregator<? super T,? extends V> aggregator)
public void update(T value)
update
in interface UnweightedSampleCollector<T>