Fix up some checkstyle/PMD complaints in Metrics code
Change-Id: Ie62062fad71225d85f3d70142d3a72cbc3003b47
diff --git a/src/main/java/net/onrc/onos/core/metrics/OnosMetrics.java b/src/main/java/net/onrc/onos/core/metrics/OnosMetrics.java
index 6c8cad2..a299407 100644
--- a/src/main/java/net/onrc/onos/core/metrics/OnosMetrics.java
+++ b/src/main/java/net/onrc/onos/core/metrics/OnosMetrics.java
@@ -48,6 +48,17 @@
public final class OnosMetrics {
/**
+ * Registry to hold the Components defined in the system.
+ */
+ private static ConcurrentMap<String, MetricsComponent> componentsRegistry =
+ new ConcurrentHashMap<>();
+
+ /**
+ * Registry for the Metrics objects created in the system.
+ */
+ private static final MetricRegistry METRICS_REGISTRY = new MetricRegistry();
+
+ /**
* Hide constructor. The only way to get the registry is through the
* singleton getter.
*/
@@ -95,11 +106,17 @@
private final String name;
/**
+ * Registry to hold the Features defined in this Component.
+ */
+ private final ConcurrentMap<String, MetricsFeature> featuresRegistry =
+ new ConcurrentHashMap<>();
+
+ /**
* Constructs a component from a name.
*
* @param newName name of the component
*/
- private Component(final String newName) {
+ Component(final String newName) {
name = newName;
}
@@ -108,12 +125,6 @@
return name;
}
- /**
- * Registry to hold the Features defined in this Component.
- */
- private ConcurrentMap<String, MetricsFeature> featuresRegistry =
- new ConcurrentHashMap<>();
-
@Override
public MetricsFeature registerFeature(final String featureName) {
MetricsFeature feature = featuresRegistry.get(featureName);
@@ -140,7 +151,7 @@
*
* @param newName name of the Feature
*/
- private Feature(final String newName) {
+ Feature(final String newName) {
name = newName;
}
@@ -151,12 +162,6 @@
}
/**
- * Registry to hold the Components defined in the system.
- */
- private static ConcurrentMap<String, MetricsComponent> componentsRegistry =
- new ConcurrentHashMap<>();
-
- /**
* Registers a component.
*
* @param name name of the Component to register
@@ -175,11 +180,6 @@
}
/**
- * Registry for the Metrics objects created in the system.
- */
- private static final MetricRegistry METRICS_REGISTRY = new MetricRegistry();
-
- /**
* Generates a name for a Metric from its component and feature.
*
* @param component component the metric is defined in