Permalink
Browse files

Add a shutdown hook for killing apps on Ctrl-C

  • Loading branch information...
1 parent 8564321 commit a3eda2d6ce996c0228112ca92885df22c20a9d57 @jwills jwills committed Jul 5, 2012
@@ -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();
}

0 comments on commit a3eda2d

Please sign in to comment.