io.github.quickmsg.common.metric.AbstractMetricRegistry Maven / Gradle / Ivy
The newest version!
package io.github.quickmsg.common.metric;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author luxurong
*/
public abstract class AbstractMetricRegistry implements MetricRegistry {
private final Map metricCounterMap = new HashMap<>();
protected AbstractMetricRegistry(List metricCounters) {
metricCounters.forEach(metricCounter -> metricCounterMap.put(metricCounter.getCounterType(), metricCounter));
}
@Override
public MetricCounter getMetricCounter(CounterType counterType) {
return metricCounterMap.get(counterType);
}
}