|
@@ -176,16 +176,18 @@ public class NodeManager extends CompositeService
|
|
|
|
|
|
private void stopRecoveryStore() throws IOException {
|
|
|
nmStore.stop();
|
|
|
- if (context.getDecommissioned() && nmStore.canRecover()) {
|
|
|
- LOG.info("Removing state store due to decommission");
|
|
|
- Configuration conf = getConfig();
|
|
|
- Path recoveryRoot = new Path(
|
|
|
- conf.get(YarnConfiguration.NM_RECOVERY_DIR));
|
|
|
- LOG.info("Removing state store at " + recoveryRoot
|
|
|
- + " due to decommission");
|
|
|
- FileSystem recoveryFs = FileSystem.getLocal(conf);
|
|
|
- if (!recoveryFs.delete(recoveryRoot, true)) {
|
|
|
- LOG.warn("Unable to delete " + recoveryRoot);
|
|
|
+ if (null != context) {
|
|
|
+ if (context.getDecommissioned() && nmStore.canRecover()) {
|
|
|
+ LOG.info("Removing state store due to decommission");
|
|
|
+ Configuration conf = getConfig();
|
|
|
+ Path recoveryRoot =
|
|
|
+ new Path(conf.get(YarnConfiguration.NM_RECOVERY_DIR));
|
|
|
+ LOG.info("Removing state store at " + recoveryRoot
|
|
|
+ + " due to decommission");
|
|
|
+ FileSystem recoveryFs = FileSystem.getLocal(conf);
|
|
|
+ if (!recoveryFs.delete(recoveryRoot, true)) {
|
|
|
+ LOG.warn("Unable to delete " + recoveryRoot);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|