HBASE-15229 Canary Tools should not call System.Exit on error (Vishal Khandelwal)
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/3b6c3057 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/3b6c3057 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/3b6c3057 Branch: refs/heads/branch-1.2 Commit: 3b6c3057d24ac1b72a2072ed2a4c34554e5c3a6d Parents: 8a2cb16 Author: Andrew Purtell <[email protected]> Authored: Wed Feb 10 10:19:49 2016 -0800 Committer: Andrew Purtell <[email protected]> Committed: Wed Feb 10 10:21:28 2016 -0800 ---------------------------------------------------------------------- .../main/java/org/apache/hadoop/hbase/tool/Canary.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/3b6c3057/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java index f21b6d2..26351ce 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java @@ -585,9 +585,9 @@ public final class Canary implements Tool { if (this.failOnError && monitor.hasError()) { monitorThread.interrupt(); if (monitor.initialized) { - System.exit(monitor.errorCode); + return monitor.errorCode; } else { - System.exit(INIT_ERROR_EXIT_CODE); + return INIT_ERROR_EXIT_CODE; } } currentTimeLength = System.currentTimeMillis() - startTime; @@ -596,17 +596,16 @@ public final class Canary implements Tool { + ") after timeout limit:" + this.timeout + " will be killed itself !!"); if (monitor.initialized) { - System.exit(TIMEOUT_ERROR_EXIT_CODE); + return TIMEOUT_ERROR_EXIT_CODE; } else { - System.exit(INIT_ERROR_EXIT_CODE); + return INIT_ERROR_EXIT_CODE; } - break; } } if (this.failOnError && monitor.finalCheckForErrors()) { monitorThread.interrupt(); - System.exit(monitor.errorCode); + return monitor.errorCode; } } finally { if (monitor != null) monitor.close(); @@ -619,7 +618,7 @@ public final class Canary implements Tool { if (choreService != null) { choreService.shutdown(); } - return(monitor.errorCode); + return monitor.errorCode; } private void printUsageAndExit() {
