adoroszlai commented on code in PR #3772:
URL: https://github.com/apache/ozone/pull/3772#discussion_r984401332
##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/server/http/HttpServer2Metrics.java:
##########
@@ -91,4 +90,10 @@ public void getMetrics(MetricsCollector collector, boolean
all) {
.addGauge(HttpServer2MetricsInfo.HttpServerThreadQueueWaitingTaskCount,
threadPool.getQueueSize());
}
+
+ public void unRegister() {
+ MetricsSystem ms = DefaultMetricsSystem.instance();
+ ms.unregisterSource(NAME);
Review Comment:
If we want to allow multiple `HttpServer2` objects to share the same
`HttpServer2Metrics` instance, then it should be reference-counted, and
unregistration should happen only when the last reference is removed.
##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/server/http/HttpServer2Metrics.java:
##########
@@ -91,4 +90,10 @@ public void getMetrics(MetricsCollector collector, boolean
all) {
.addGauge(HttpServer2MetricsInfo.HttpServerThreadQueueWaitingTaskCount,
threadPool.getQueueSize());
}
+
+ public void unRegister() {
Review Comment:
Should be `synchronized` to ensure consistent synchronization when accessing
`instance`. (I guess findbugs also complains about this.)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]