aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-search/src
diff options
context:
space:
mode:
authorStephane Gamard <stephane.gamard@searchbox.com>2014-07-17 11:43:47 +0200
committerStephane Gamard <stephane.gamard@searchbox.com>2014-07-18 11:27:59 +0200
commit2ac26bfb14fa7e60f5c0fce212f092275630734b (patch)
tree3d9194be53feac6d9009bf5f3f0130366650d792 /server/sonar-search/src
parent672ae499cf6418725e63b9beb5630a304f86ae01 (diff)
downloadsonarqube-2ac26bfb14fa7e60f5c0fce212f092275630734b.tar.gz
sonarqube-2ac26bfb14fa7e60f5c0fce212f092275630734b.zip
SONAR-5408 - Added workingDirectory to ProcessWrapper
Diffstat (limited to 'server/sonar-search/src')
-rw-r--r--server/sonar-search/src/main/java/org/sonar/search/ElasticSearch.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/server/sonar-search/src/main/java/org/sonar/search/ElasticSearch.java b/server/sonar-search/src/main/java/org/sonar/search/ElasticSearch.java
index e07850b285d..7f72ad39969 100644
--- a/server/sonar-search/src/main/java/org/sonar/search/ElasticSearch.java
+++ b/server/sonar-search/src/main/java/org/sonar/search/ElasticSearch.java
@@ -21,6 +21,7 @@ package org.sonar.search;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus;
import org.elasticsearch.common.settings.ImmutableSettings;
+import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.node.Node;
import org.elasticsearch.node.NodeBuilder;
import org.slf4j.Logger;
@@ -104,9 +105,14 @@ public class ElasticSearch extends Process {
@Override
public boolean isReady() {
try {
- ClusterHealthStatus status = node.client().admin().cluster().prepareClusterStats()
- .get().getStatus();
- return status != null && status == ClusterHealthStatus.GREEN;
+ return (node.client().admin().cluster().prepareHealth()
+ .setWaitForYellowStatus()
+ .setTimeout(TimeValue.timeValueSeconds(3L))
+ .get()
+ .getStatus() != ClusterHealthStatus.RED);
+// ClusterHealthStatus status = node.client().admin().cluster().prepareClusterStats()
+// .get().getStatus();
+// return status != null && status == ClusterHealthStatus.GREEN;
} catch (Exception e) {
return false;
}