From 9045f371469ade40f42cc4a82fa9d9df95552a3c Mon Sep 17 00:00:00 2001 From: Eric Hartmann Date: Mon, 25 Sep 2017 12:01:52 +0200 Subject: [PATCH] SONAR-9789 Display once a log message when waiting for ES to be up and running --- .../main/java/org/sonar/application/SchedulerImpl.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/server/sonar-main/src/main/java/org/sonar/application/SchedulerImpl.java b/server/sonar-main/src/main/java/org/sonar/application/SchedulerImpl.java index 8589e29414a..943f5de6efa 100644 --- a/server/sonar-main/src/main/java/org/sonar/application/SchedulerImpl.java +++ b/server/sonar-main/src/main/java/org/sonar/application/SchedulerImpl.java @@ -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 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)) { -- 2.39.5