rpuch commented on code in PR #7488:
URL: https://github.com/apache/ignite-3/pull/7488#discussion_r2752673196
##########
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:
If it's thrown by the busy lock in this fragment of code, then let's just
use an idiom 'try to take a lock and if we're not successful, don't do
anything' instead of producing the exception and immediately catching it
--
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]