public class MaxMetricAggregatorProvider implements MetricAggregatorProvider{
@Override
return new MaxMetricAggregator();
}
private Double value = null;
@Override
public void append(Number calculated) {
if (value == null) {
value = calculated.doubleValue();
}
else {
value = Math.max(value,calculated.doubleValue());
}
}
@Override
public Double getAggregated() {
return value;
}
@Override
public void reset() {
value = null;
}
@Override
public String getName() {
return "max";
}
}
}