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

View File

@ -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 Collection<EndpointStateMachine> getValues() {
public void close() throws IOException {
getValues().forEach(endpointStateMachine
-> IOUtils.cleanupWithLogger(LOG, endpointStateMachine));
MBeans.unregister(jmxBean);
if (jmxBean != null) {
MBeans.unregister(jmxBean);
jmxBean = null;
}
}
@Override