HDDS-514. Clean Unregister JMX upon SCMConnectionManager#close.

Contributed by Xiaoyu Yao.
This commit is contained in:
Anu Engineer 2018-09-20 12:21:34 -07:00
parent 096a716080
commit 524f7cd354
1 changed files with 5 additions and 2 deletions

View File

@ -59,7 +59,7 @@ public class SCMConnectionManager
private final int rpcTimeout; private final int rpcTimeout;
private final Configuration conf; private final Configuration conf;
private final ObjectName jmxBean; private ObjectName jmxBean;
public SCMConnectionManager(Configuration conf) { public SCMConnectionManager(Configuration conf) {
this.mapLock = new ReentrantReadWriteLock(); this.mapLock = new ReentrantReadWriteLock();
@ -191,7 +191,10 @@ public class SCMConnectionManager
public void close() throws IOException { public void close() throws IOException {
getValues().forEach(endpointStateMachine getValues().forEach(endpointStateMachine
-> IOUtils.cleanupWithLogger(LOG, endpointStateMachine)); -> IOUtils.cleanupWithLogger(LOG, endpointStateMachine));
MBeans.unregister(jmxBean); if (jmxBean != null) {
MBeans.unregister(jmxBean);
jmxBean = null;
}
} }
@Override @Override