]> source.dussan.org Git - sonarqube.git/commitdiff
fix wrong "ce started" log after ce startup failure 2644/head
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Mon, 9 Oct 2017 12:59:38 +0000 (14:59 +0200)
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Tue, 10 Oct 2017 13:03:22 +0000 (15:03 +0200)
server/sonar-ce/src/main/java/org/sonar/ce/app/CeServer.java

index f36ff2c2251fcc5eb14374f1249bde0c687910cb..1a7ecf8250f4e34391e6ebe830d339b8df233752 100644 (file)
@@ -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;