diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/scm/block/BlockManagerImpl.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/scm/block/BlockManagerImpl.java index 472dc7d08d7..23b1c8bdd2f 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/scm/block/BlockManagerImpl.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/scm/block/BlockManagerImpl.java @@ -105,7 +105,7 @@ public class BlockManagerImpl implements BlockManager, BlockmanagerMXBean { Map> containers; private final int containerProvisionBatchSize; private final Random rand; - private final ObjectName mxBean; + private ObjectName mxBean; /** @@ -588,7 +588,10 @@ public class BlockManagerImpl implements BlockManager, BlockmanagerMXBean { deletedBlockLog.close(); } blockDeletingService.shutdown(); - MBeans.unregister(mxBean); + if (mxBean != null) { + MBeans.unregister(mxBean); + mxBean = null; + } } @Override