aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-application/src/main/java
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2016-07-30 10:09:48 +0200
committerSimon Brandhof <simon.brandhof@sonarsource.com>2016-08-03 17:57:17 +0200
commit5291ade14f2a05d923dd0af2421247b804c2b418 (patch)
tree6cc29b5cbf568a3d45136bb44bb9beb38833833e /sonar-application/src/main/java
parent80ada8c264e73426330c79e40e44f36ded7dcc19 (diff)
downloadsonarqube-5291ade14f2a05d923dd0af2421247b804c2b418.tar.gz
sonarqube-5291ade14f2a05d923dd0af2421247b804c2b418.zip
SONAR-7908 ability to disable Elasticsearch process
Diffstat (limited to 'sonar-application/src/main/java')
-rw-r--r--sonar-application/src/main/java/org/sonar/application/App.java23
1 files changed, 13 insertions, 10 deletions
diff --git a/sonar-application/src/main/java/org/sonar/application/App.java b/sonar-application/src/main/java/org/sonar/application/App.java
index b8f08d18bf3..8109f0ed0ac 100644
--- a/sonar-application/src/main/java/org/sonar/application/App.java
+++ b/sonar-application/src/main/java/org/sonar/application/App.java
@@ -24,7 +24,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import org.apache.commons.io.FilenameUtils;
-import org.apache.commons.lang.StringUtils;
import org.sonar.process.ProcessId;
import org.sonar.process.ProcessProperties;
import org.sonar.process.Props;
@@ -57,22 +56,26 @@ public class App implements Stoppable {
private static List<JavaCommand> createCommands(Props props) {
File homeDir = props.nonNullValueAsFile(ProcessProperties.PATH_HOME);
List<JavaCommand> commands = new ArrayList<>(3);
- commands.add(createESCommand(props, homeDir));
+ if (isProcessEnabled(props, ProcessProperties.CLUSTER_SEARCH_DISABLED)) {
+ commands.add(createESCommand(props, homeDir));
+ }
- // do not yet start WebServer nor CE on elasticsearch slaves
- if (StringUtils.isBlank(props.value(ProcessProperties.CLUSTER_MASTER_HOST))) {
- if (!props.valueAsBoolean(ProcessProperties.CLUSTER_WEB_DISABLED)) {
- commands.add(createWebServerCommand(props, homeDir));
- }
+ if (isProcessEnabled(props, ProcessProperties.CLUSTER_WEB_DISABLED)) {
+ commands.add(createWebServerCommand(props, homeDir));
+ }
- if (!props.valueAsBoolean(ProcessProperties.CLUSTER_CE_DISABLED)) {
- commands.add(createCeServerCommand(props, homeDir));
- }
+ if (isProcessEnabled(props, ProcessProperties.CLUSTER_CE_DISABLED)) {
+ commands.add(createCeServerCommand(props, homeDir));
}
return commands;
}
+ private static boolean isProcessEnabled(Props props, String disabledPropertyKey) {
+ return !props.valueAsBoolean(ProcessProperties.CLUSTER_ENABLED) ||
+ !props.valueAsBoolean(disabledPropertyKey);
+ }
+
private static JavaCommand createESCommand(Props props, File homeDir) {
JavaCommand elasticsearch = new JavaCommand(ProcessId.ELASTICSEARCH);
elasticsearch