if (config == null) {
throw new NullPointerException("config cannot be null");
}
Counter counter = config.createCounter();
if (counter instanceof SampledCounterImpl) {
SampledCounterImpl sampledCounter = (SampledCounterImpl) counter;
timer.schedule(sampledCounter.getTimerTask(), sampledCounter.getIntervalMillis(), sampledCounter.getIntervalMillis());
}
counters.add(counter);
return counter;
}