Skip to content

Commit

Permalink
Add a shutdown hook for killing apps on Ctrl-C
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Wills committed Jul 5, 2012
1 parent 8564321 commit a3eda2d
Showing 1 changed file with 10 additions and 0 deletions.
Expand Up @@ -102,6 +102,16 @@ protected void startUp() {
appContext.setPriority(ContainerLaunchContextFactory.createPriority(appMasterParams.getPriority()));
submitApplication(appContext);

// Make sure we stop the application in the case that it isn't done already.
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
if (YarnClientServiceImpl.this.isRunning()) {
YarnClientServiceImpl.this.stop();
}
}
});

stopwatch.start();
}

Expand Down

0 comments on commit a3eda2d

Please sign in to comment.