コード例 #1
0
 private void notifyMetricRemoved(MetricName name) {
   for (MetricsRegistryListener listener : listeners) {
     listener.onMetricRemoved(name);
   }
 }
コード例 #2
0
 private void notifyMetricAdded(MetricName name, Metric metric) {
   for (MetricsRegistryListener listener : listeners) {
     listener.onMetricAdded(name, metric);
   }
 }
コード例 #3
0
 /**
  * Adds a {@link MetricsRegistryListener} to a collection of listeners that will be notified on
  * metric creation. Listeners will be notified in the order in which they are added.
  *
  * <p><b>N.B.:</b> The listener will be notified of all existing metrics when it first registers.
  *
  * @param listener the listener that will be notified
  */
 public void addListener(MetricsRegistryListener listener) {
   listeners.add(listener);
   for (Map.Entry<MetricName, Metric> entry : metrics.entrySet()) {
     listener.onMetricAdded(entry.getKey(), entry.getValue());
   }
 }