|
@@ -82,6 +82,24 @@ import com.google.common.annotations.VisibleForTesting;
|
|
public class NodeManager extends CompositeService
|
|
public class NodeManager extends CompositeService
|
|
implements EventHandler<NodeManagerEvent> {
|
|
implements EventHandler<NodeManagerEvent> {
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Node manager return status codes.
|
|
|
|
+ */
|
|
|
|
+ public enum NodeManagerStatus {
|
|
|
|
+ NO_ERROR(0),
|
|
|
|
+ EXCEPTION(1);
|
|
|
|
+
|
|
|
|
+ private int exitCode;
|
|
|
|
+
|
|
|
|
+ NodeManagerStatus(int exitCode) {
|
|
|
|
+ this.exitCode = exitCode;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public int getExitCode() {
|
|
|
|
+ return exitCode;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Priority of the NodeManager shutdown hook.
|
|
* Priority of the NodeManager shutdown hook.
|
|
*/
|
|
*/
|
|
@@ -421,7 +439,7 @@ public class NodeManager extends CompositeService
|
|
return "NodeManager";
|
|
return "NodeManager";
|
|
}
|
|
}
|
|
|
|
|
|
- protected void shutDown() {
|
|
|
|
|
|
+ protected void shutDown(final int exitCode) {
|
|
new Thread() {
|
|
new Thread() {
|
|
@Override
|
|
@Override
|
|
public void run() {
|
|
public void run() {
|
|
@@ -432,7 +450,7 @@ public class NodeManager extends CompositeService
|
|
} finally {
|
|
} finally {
|
|
if (shouldExitOnShutdownEvent
|
|
if (shouldExitOnShutdownEvent
|
|
&& !ShutdownHookManager.get().isShutdownInProgress()) {
|
|
&& !ShutdownHookManager.get().isShutdownInProgress()) {
|
|
- ExitUtil.terminate(-1);
|
|
|
|
|
|
+ ExitUtil.terminate(exitCode);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -457,7 +475,7 @@ public class NodeManager extends CompositeService
|
|
.rebootNodeStatusUpdaterAndRegisterWithRM();
|
|
.rebootNodeStatusUpdaterAndRegisterWithRM();
|
|
} catch (YarnRuntimeException e) {
|
|
} catch (YarnRuntimeException e) {
|
|
LOG.fatal("Error while rebooting NodeStatusUpdater.", e);
|
|
LOG.fatal("Error while rebooting NodeStatusUpdater.", e);
|
|
- shutDown();
|
|
|
|
|
|
+ shutDown(NodeManagerStatus.EXCEPTION.getExitCode());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}.start();
|
|
}.start();
|
|
@@ -744,7 +762,7 @@ public class NodeManager extends CompositeService
|
|
public void handle(NodeManagerEvent event) {
|
|
public void handle(NodeManagerEvent event) {
|
|
switch (event.getType()) {
|
|
switch (event.getType()) {
|
|
case SHUTDOWN:
|
|
case SHUTDOWN:
|
|
- shutDown();
|
|
|
|
|
|
+ shutDown(NodeManagerStatus.NO_ERROR.getExitCode());
|
|
break;
|
|
break;
|
|
case RESYNC:
|
|
case RESYNC:
|
|
resyncWithRM();
|
|
resyncWithRM();
|