adityamukho commented on code in PR #7488:
URL: https://github.com/apache/ignite-3/pull/7488#discussion_r2757416232


##########
modules/metrics/src/main/java/org/apache/ignite/internal/metrics/MetricManagerImpl.java:
##########
@@ -186,18 +188,38 @@ public void registerSource(MetricSource src) {
 
     @Override
     public void unregisterSource(MetricSource src) {
-        inBusyLockSafe(busyLock, () -> {
-            disable(src);
-            registry.unregisterSource(src);
-        });
+        try {
+            if (metricSources().contains(src)) {
+                inBusyLockSafe(busyLock, () -> {
+                    disable(src);
+                    registry.unregisterSource(src);
+                });
+            }
+        } catch (Exception e) {
+            Throwable rootEx = unwrapRootCause(e);
+
+            if (!(rootEx instanceof NodeStoppingException)) {
+                log.error("Failed to unregister metrics source {}", e, 
src.name());
+            }

Review Comment:
   > Let's use ExceptionUtils.hasCause().
   👍 



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