From 2963d59ed21de246390426cbdb57c160a4f65303 Mon Sep 17 00:00:00 2001 From: Andrew Purtell Date: Wed, 10 Feb 2016 10:19:49 -0800 Subject: [PATCH] HBASE-15229 Canary Tools should not call System.Exit on error (Vishal Khandelwal) --- .../java/org/apache/hadoop/hbase/tool/Canary.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) 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 b2cca32793f..9248c71291a 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 @@ -607,9 +607,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; @@ -618,17 +618,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(); @@ -641,7 +640,7 @@ public final class Canary implements Tool { if (choreService != null) { choreService.shutdown(); } - return(monitor.errorCode); + return monitor.errorCode; } private void printUsageAndExit() {