Ray Milkey | 26921af | 2014-06-30 16:27:40 -0700 | [diff] [blame^] | 1 | package net.onrc.onos.core.metrics; |
| 2 | |
| 3 | import com.codahale.metrics.MetricRegistry; |
| 4 | |
| 5 | /** |
| 6 | * This class acts a singleton to hold the Metrics registry for ONOS. |
| 7 | */ |
| 8 | public final class OnosMetrics { |
| 9 | |
| 10 | /** |
| 11 | * Hide constructor. The only way to get the registry is through the |
| 12 | * singleton getter. |
| 13 | */ |
| 14 | private OnosMetrics() {} |
| 15 | |
| 16 | private static final MetricRegistry METRICS_REGISTRY = new MetricRegistry(); |
| 17 | |
| 18 | /** |
| 19 | * Get the singleton Metrics registry. A single instance of |
| 20 | * the registry is statically allocated and then used by all callers. |
| 21 | * |
| 22 | * @return Metrics registry |
| 23 | */ |
| 24 | public static MetricRegistry getMetricsRegistry() { |
| 25 | return METRICS_REGISTRY; |
| 26 | } |
| 27 | } |
| 28 | |