Alachisoft.NCache.MetricsAgents.MetricsAgentManager Maven / Gradle / Ivy
The newest version!
package Alachisoft.NCache.MetricsAgents;
import com.alachisoft.ncache.common.monitoring.CounterMetadata;
import Alachisoft.NCache.DataModel.CounterData;
import java.util.ArrayList;
import java.util.List;
public class MetricsAgentManager implements AutoCloseable {
private List metricsAgents = new ArrayList<>();
public void addMetricsAgent(MetricsAgent metricsAgent) {
if (metricsAgent != null)
metricsAgents.add(metricsAgent);
}
public void initializeCounterInstance(String instanceName, String counterName, CounterMetadata counterMetaData) {
for (MetricsAgent metricsAgent : metricsAgents) {
metricsAgent.initializeCounterInstance(instanceName, counterName, counterMetaData);
}
}
public void publishCounterData(String instanceName, CounterData counterData, List counterParams) {
for (MetricsAgent metricsAgent : metricsAgents) {
metricsAgent.publishCounterData(instanceName, counterData, counterParams);
}
}
public void disposeCounterInstance(String instanceName, List counterParams) {
for (MetricsAgent metricsAgent : metricsAgents) {
metricsAgent.disposeCounterInstance(instanceName, counterParams);
}
}
@Override
public void close() {
for (MetricsAgent metricsAgent : metricsAgents) {
metricsAgent.dispose();
}
metricsAgents.clear();
}
}