shubhampatel28 commented on code in PR #13851:
URL: https://github.com/apache/hudi/pull/13851#discussion_r2338206530


##########
hudi-common/src/main/java/org/apache/hudi/metrics/prometheus/PrometheusReporter.java:
##########
@@ -101,12 +148,86 @@ public void report() {
 
   @Override
   public void stop() {
-    collectorRegistry.unregister(metricExports);
-    HTTPServer httpServer = PORT_TO_SERVER.remove(serverPort);
-    if (httpServer != null) {
-      httpServer.stop();
+    if (stopped.get()) {
+      LOG.debug("PrometheusReporter.stop() called for port {} but already 
stopped", serverPort);
+      return;
+    }
+    
+    try {
+      synchronized (PrometheusReporter.class) {
+        stopped.set(true);
+        LOG.debug("PrometheusReporter.stop() called for port {}", serverPort);
+        unregisterMetricExports();
+        removeFromExportsTracking();

Review Comment:
   make sense.. that can help reduce the hashmap look from 3 times to only 1 
and then use the passed param. 



-- 
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]

Reply via email to