]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-9789 Display once a log message when waiting for ES to be up and running
authorEric Hartmann <hartmann.eric@gmail.com>
Mon, 25 Sep 2017 10:01:52 +0000 (12:01 +0200)
committerEric Hartmann <hartmann.eric@gmail.Com>
Wed, 27 Sep 2017 06:47:39 +0000 (08:47 +0200)
server/sonar-main/src/main/java/org/sonar/application/SchedulerImpl.java

index 8589e29414a9edc3b41002669af3346d11592abc..943f5de6efaeba8c8122f9e0c6e66849d0916866 100644 (file)
@@ -53,6 +53,7 @@ public class SchedulerImpl implements Scheduler, ProcessEventListener, ProcessLi
   private final NodeLifecycle nodeLifecycle = new NodeLifecycle();
 
   private final CountDownLatch keepAlive = new CountDownLatch(1);
+  private final AtomicBoolean firstWaitingEsLog = new AtomicBoolean(true);
   private final AtomicBoolean restartRequested = new AtomicBoolean(false);
   private final AtomicBoolean restartDisabled = new AtomicBoolean(false);
   private final EnumMap<ProcessId, SQProcess> processesById = new EnumMap<>(ProcessId.class);
@@ -113,7 +114,13 @@ public class SchedulerImpl implements Scheduler, ProcessEventListener, ProcessLi
 
   private void tryToStartWeb() {
     SQProcess process = processesById.get(ProcessId.WEB_SERVER);
-    if (process == null || !isEsClientStartable()) {
+    if (process == null) {
+      return;
+    }
+    if (!isEsClientStartable()) {
+      if (firstWaitingEsLog.getAndSet(false)) {
+        LOG.info("Waiting for Elasticsearch to be up and running");
+      }
       return;
     }
     if (appState.isOperational(ProcessId.WEB_SERVER, false)) {