summaryrefslogtreecommitdiff
path: root/zookeeper-server/src/main/java/org/apache/zookeeper/util/ServiceUtils.java
diff options
context:
space:
mode:
Diffstat (limited to 'zookeeper-server/src/main/java/org/apache/zookeeper/util/ServiceUtils.java')
-rw-r--r--zookeeper-server/src/main/java/org/apache/zookeeper/util/ServiceUtils.java15
1 files changed, 13 insertions, 2 deletions
diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/util/ServiceUtils.java b/zookeeper-server/src/main/java/org/apache/zookeeper/util/ServiceUtils.java
index 544e13d7f..944bbc03c 100644
--- a/zookeeper-server/src/main/java/org/apache/zookeeper/util/ServiceUtils.java
+++ b/zookeeper-server/src/main/java/org/apache/zookeeper/util/ServiceUtils.java
@@ -39,7 +39,14 @@ public abstract class ServiceUtils {
*/
@SuppressFBWarnings("DM_EXIT")
public static final Consumer<Integer> SYSTEM_EXIT = (code) -> {
- LOG.error("Exiting JVM with code {}", code);
+ String msg = "Exiting JVM with code {}";
+ if (code == 0) {
+ // JVM exits normally
+ LOG.info(msg, code);
+ } else {
+ // JVM exits with error
+ LOG.error(msg, code);
+ }
System.exit(code);
};
@@ -47,8 +54,12 @@ public abstract class ServiceUtils {
* No-op strategy, useful for tests.
*/
public static final Consumer<Integer> LOG_ONLY = (code) -> {
- LOG.error("Fatal error, JVM should exit with code {}. "
+ if (code != 0) {
+ LOG.error("Fatal error, JVM should exit with code {}. "
+ "Actually System.exit is disabled", code);
+ } else {
+ LOG.info("JVM should exit with code {}. Actually System.exit is disabled", code);
+ }
};
private static volatile Consumer<Integer> systemExitProcedure = SYSTEM_EXIT;