Apache9 commented on code in PR #6995:
URL: https://github.com/apache/hbase/pull/6995#discussion_r2119897740


##########
hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/metrics/impl/GlobalMetricRegistriesAdapter.java:
##########
@@ -126,6 +127,20 @@ private void doRun() {
         continue;
       }
 
+      // To determine whether a new MetricRegistry is created in registries,
+      // Need to remove the old MetricRegistry in registeredSources for the 
new MetricRegistry
+      // https://issues.apache.org/jira/browse/HBASE-29322
+      MetricsSourceAdapter registeredSource = registeredSources.get(info);
+      if (registeredSource != null && 
!Objects.equals(registeredSource.registry, registry)) {
+        registeredSources.remove(info);
+        synchronized (DefaultMetricsSystem.instance()) {

Review Comment:
   Why here we need sychronized?



-- 
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: issues-unsubscr...@hbase.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to