Skip to content

Commit e8cb2ae

Browse files
committed
HDFS-11041. Unable to unregister FsDatasetState MBean if DataNode is shutdown twice. Contributed by Wei-Chiu Chuang.
1 parent f645324 commit e8cb2ae

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2385,6 +2385,7 @@ public void shutdown() {
23852385

23862386
if (mbeanName != null) {
23872387
MBeans.unregister(mbeanName);
2388+
mbeanName = null;
23882389
}
23892390

23902391
if (asyncDiskService != null) {

hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/SimulatedFSDataset.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1367,7 +1367,10 @@ void registerMBean(final String storageId) {
13671367

13681368
@Override
13691369
public void shutdown() {
1370-
if (mbeanName != null) MBeans.unregister(mbeanName);
1370+
if (mbeanName != null) {
1371+
MBeans.unregister(mbeanName);
1372+
mbeanName = null;
1373+
}
13711374
}
13721375

13731376
@Override

0 commit comments

Comments
 (0)