|
@@ -3132,7 +3132,7 @@ public class DataNode extends ReconfigurableBase
|
|
|
@Override // DataNodeMXBean
|
|
|
public String getDiskBalancerStatus() {
|
|
|
try {
|
|
|
- return this.diskBalancer.queryWorkStatus().toJsonString();
|
|
|
+ return getDiskBalancer().queryWorkStatus().toJsonString();
|
|
|
} catch (IOException ex) {
|
|
|
LOG.debug("Reading diskbalancer Status failed. ex:{}", ex);
|
|
|
return "";
|
|
@@ -3510,7 +3510,7 @@ public class DataNode extends ReconfigurableBase
|
|
|
DiskBalancerException.Result.DATANODE_STATUS_NOT_REGULAR);
|
|
|
}
|
|
|
|
|
|
- this.diskBalancer.submitPlan(planID, planVersion, planFile, planData,
|
|
|
+ getDiskBalancer().submitPlan(planID, planVersion, planFile, planData,
|
|
|
skipDateCheck);
|
|
|
}
|
|
|
|
|
@@ -3522,7 +3522,7 @@ public class DataNode extends ReconfigurableBase
|
|
|
public void cancelDiskBalancePlan(String planID) throws
|
|
|
IOException {
|
|
|
checkSuperuserPrivilege();
|
|
|
- this.diskBalancer.cancelPlan(planID);
|
|
|
+ getDiskBalancer().cancelPlan(planID);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -3533,7 +3533,7 @@ public class DataNode extends ReconfigurableBase
|
|
|
@Override
|
|
|
public DiskBalancerWorkStatus queryDiskBalancerPlan() throws IOException {
|
|
|
checkSuperuserPrivilege();
|
|
|
- return this.diskBalancer.queryWorkStatus();
|
|
|
+ return getDiskBalancer().queryWorkStatus();
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -3550,9 +3550,9 @@ public class DataNode extends ReconfigurableBase
|
|
|
Preconditions.checkNotNull(key);
|
|
|
switch (key) {
|
|
|
case DiskBalancerConstants.DISKBALANCER_VOLUME_NAME:
|
|
|
- return this.diskBalancer.getVolumeNames();
|
|
|
+ return getDiskBalancer().getVolumeNames();
|
|
|
case DiskBalancerConstants.DISKBALANCER_BANDWIDTH :
|
|
|
- return Long.toString(this.diskBalancer.getBandwidth());
|
|
|
+ return Long.toString(getDiskBalancer().getBandwidth());
|
|
|
default:
|
|
|
LOG.error("Disk Balancer - Unknown key in get balancer setting. Key: {}",
|
|
|
key);
|
|
@@ -3606,4 +3606,11 @@ public class DataNode extends ReconfigurableBase
|
|
|
}
|
|
|
return volumeInfoList;
|
|
|
}
|
|
|
+
|
|
|
+ private DiskBalancer getDiskBalancer() throws IOException {
|
|
|
+ if (this.diskBalancer == null) {
|
|
|
+ throw new IOException("DiskBalancer is not initialized");
|
|
|
+ }
|
|
|
+ return this.diskBalancer;
|
|
|
+ }
|
|
|
}
|