From 3bcf9ea40fe7dc563a1c8e438c0f6e3b5226466d Mon Sep 17 00:00:00 2001 From: Sébastien Lesaint Date: Mon, 9 Oct 2017 14:59:38 +0200 Subject: fix wrong "ce started" log after ce startup failure --- server/sonar-ce/src/main/java/org/sonar/ce/app/CeServer.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'server/sonar-ce') diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/app/CeServer.java b/server/sonar-ce/src/main/java/org/sonar/ce/app/CeServer.java index f36ff2c2251..1a7ecf8250f 100644 --- a/server/sonar-ce/src/main/java/org/sonar/ce/app/CeServer.java +++ b/server/sonar-ce/src/main/java/org/sonar/ce/app/CeServer.java @@ -80,7 +80,7 @@ public class CeServer implements Monitored { checkState(ceMainThread != null, "getStatus() can not be called before start()"); if (ceMainThread.isStarted()) { - return Status.OPERATIONAL; + return ceMainThread.isOperational() ? Status.OPERATIONAL : Status.FAILED; } return Status.DOWN; } @@ -130,6 +130,7 @@ public class CeServer implements Monitored { private static final int CHECK_FOR_STOP_DELAY = 50; private volatile boolean stop = false; private volatile boolean started = false; + private volatile boolean operational = false; public CeMainThread() { super(CE_MAIN_THREAD_NAME); @@ -138,6 +139,7 @@ public class CeServer implements Monitored { @Override public void run() { boolean startupSuccessful = attemptStartup(); + this.operational = startupSuccessful; this.started = true; if (startupSuccessful) { // call below is blocking @@ -196,6 +198,10 @@ public class CeServer implements Monitored { return started; } + public boolean isOperational() { + return operational; + } + public void stopIt() { // stop looping indefinitely this.stop = true; -- cgit v1.2.3