diff options
author | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2017-02-21 14:51:34 +0100 |
---|---|---|
committer | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2017-02-24 21:08:18 +0100 |
commit | 679db32dc10eebf6e7d8cfddc44aa719696485ed (patch) | |
tree | 94b3022c04611200761432d6ab45d56584702044 /server/sonar-search | |
parent | f4b7d2d78416ba858d2c2f7998f3c320c95ad1e4 (diff) | |
download | sonarqube-679db32dc10eebf6e7d8cfddc44aa719696485ed.tar.gz sonarqube-679db32dc10eebf6e7d8cfddc44aa719696485ed.zip |
SONAR-8435 log "SonarQube is up" if all processes are operational
which implies:
1/ to distinguish from Monitored#getStatus() = UP and OPERATIONAL
2/ to have an option of Monitor to wait on process's status to be OPERATIONAL
3/ every Monitored implementation must return OPERATIONAL rather than UP if then don't make a distinction between the two
Diffstat (limited to 'server/sonar-search')
-rw-r--r-- | server/sonar-search/src/main/java/org/sonar/search/SearchServer.java | 5 | ||||
-rw-r--r-- | server/sonar-search/src/test/java/org/sonar/search/SearchServerTest.java | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/server/sonar-search/src/main/java/org/sonar/search/SearchServer.java b/server/sonar-search/src/main/java/org/sonar/search/SearchServer.java index b35ff952f27..6929b44212a 100644 --- a/server/sonar-search/src/main/java/org/sonar/search/SearchServer.java +++ b/server/sonar-search/src/main/java/org/sonar/search/SearchServer.java @@ -62,7 +62,10 @@ public class SearchServer implements Monitored { .setTimeout(TimeValue.timeValueSeconds(30L)) .get() .getStatus() != ClusterHealthStatus.RED; - return esStatus ? Status.UP : Status.DOWN; + if (esStatus) { + return Status.OPERATIONAL; + } + return Status.DOWN; } @Override diff --git a/server/sonar-search/src/test/java/org/sonar/search/SearchServerTest.java b/server/sonar-search/src/test/java/org/sonar/search/SearchServerTest.java index d1ed8480767..ddfcd68fbc5 100644 --- a/server/sonar-search/src/test/java/org/sonar/search/SearchServerTest.java +++ b/server/sonar-search/src/test/java/org/sonar/search/SearchServerTest.java @@ -83,7 +83,7 @@ public class SearchServerTest { underTest = new SearchServer(props); underTest.start(); - assertThat(underTest.getStatus()).isEqualTo(Monitored.Status.UP); + assertThat(underTest.getStatus()).isEqualTo(Monitored.Status.OPERATIONAL); Settings settings = Settings.builder().put("cluster.name", A_CLUSTER_NAME).build(); client = TransportClient.builder().settings(settings).build() |