From 524f7cd354e0683c9ec61fdbce344ef79b841728 Mon Sep 17 00:00:00 2001 From: Anu Engineer Date: Thu, 20 Sep 2018 12:21:34 -0700 Subject: [PATCH] HDDS-514. Clean Unregister JMX upon SCMConnectionManager#close. Contributed by Xiaoyu Yao. --- .../common/statemachine/SCMConnectionManager.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/SCMConnectionManager.java b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/SCMConnectionManager.java index 85fb5805241..775a91a3d4f 100644 --- a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/SCMConnectionManager.java +++ b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/SCMConnectionManager.java @@ -59,7 +59,7 @@ public class SCMConnectionManager private final int rpcTimeout; private final Configuration conf; - private final ObjectName jmxBean; + private ObjectName jmxBean; public SCMConnectionManager(Configuration conf) { this.mapLock = new ReentrantReadWriteLock(); @@ -191,7 +191,10 @@ public class SCMConnectionManager public void close() throws IOException { getValues().forEach(endpointStateMachine -> IOUtils.cleanupWithLogger(LOG, endpointStateMachine)); - MBeans.unregister(jmxBean); + if (jmxBean != null) { + MBeans.unregister(jmxBean); + jmxBean = null; + } } @Override