aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-application/src/main/java/org/sonar
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2017-02-24 16:46:37 +0100
committerSimon Brandhof <simon.brandhof@sonarsource.com>2017-02-26 07:38:05 +0100
commit76a4e8fb654e850944ff179ba945989fe7afecec (patch)
tree37107caf2462577eeba0b657728b18535f127e51 /sonar-application/src/main/java/org/sonar
parent03acebc23f8902d64efd7689cadb2711f9ac67b3 (diff)
downloadsonarqube-76a4e8fb654e850944ff179ba945989fe7afecec.tar.gz
sonarqube-76a4e8fb654e850944ff179ba945989fe7afecec.zip
Drop usages of MyBatis#openSession()
in favor of DbClient#openSession()
Diffstat (limited to 'sonar-application/src/main/java/org/sonar')
-rw-r--r--sonar-application/src/main/java/org/sonar/application/App.java39
-rw-r--r--sonar-application/src/main/java/org/sonar/application/JavaCommandFactoryImpl.java70
2 files changed, 55 insertions, 54 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 8fc3ba6f5b3..01c965f822c 100644
--- a/sonar-application/src/main/java/org/sonar/application/App.java
+++ b/sonar-application/src/main/java/org/sonar/application/App.java
@@ -75,7 +75,8 @@ public class App implements Stoppable {
}
@VisibleForTesting
- App(Properties commandLineArguments, Function<Properties, Props> propsSupplier, Monitor monitor, CheckFSConfigOnReload checkFsConfigOnReload, JavaCommandFactory javaCommandFactory) {
+ App(Properties commandLineArguments, Function<Properties, Props> propsSupplier, Monitor monitor, CheckFSConfigOnReload checkFsConfigOnReload,
+ JavaCommandFactory javaCommandFactory) {
this.commandLineArguments = commandLineArguments;
this.propsSupplier = propsSupplier;
this.javaCommandFactory = javaCommandFactory;
@@ -88,24 +89,6 @@ public class App implements Stoppable {
monitor.awaitTermination();
}
- private List<JavaCommand> createCommands(Props props) {
- File homeDir = props.nonNullValueAsFile(ProcessProperties.PATH_HOME);
- List<JavaCommand> commands = new ArrayList<>(3);
- if (isProcessEnabled(props, ProcessProperties.CLUSTER_SEARCH_DISABLED)) {
- commands.add(javaCommandFactory.createESCommand(props, homeDir));
- }
-
- if (isProcessEnabled(props, ProcessProperties.CLUSTER_WEB_DISABLED)) {
- commands.add(javaCommandFactory.createWebCommand(props, homeDir));
- }
-
- if (isProcessEnabled(props, ProcessProperties.CLUSTER_CE_DISABLED)) {
- commands.add(javaCommandFactory.createCeCommand(props, homeDir));
- }
-
- return commands;
- }
-
private static boolean isProcessEnabled(Props props, String disabledPropertyKey) {
return !props.valueAsBoolean(ProcessProperties.CLUSTER_ENABLED) ||
!props.valueAsBoolean(disabledPropertyKey);
@@ -176,5 +159,23 @@ public class App implements Stoppable {
return createCommands(reloadedProps);
}
+
+ private List<JavaCommand> createCommands(Props props) {
+ File homeDir = props.nonNullValueAsFile(ProcessProperties.PATH_HOME);
+ List<JavaCommand> commands = new ArrayList<>(3);
+ if (isProcessEnabled(props, ProcessProperties.CLUSTER_SEARCH_DISABLED)) {
+ commands.add(javaCommandFactory.createESCommand(props, homeDir));
+ }
+
+ if (isProcessEnabled(props, ProcessProperties.CLUSTER_WEB_DISABLED)) {
+ commands.add(javaCommandFactory.createWebCommand(props, homeDir));
+ }
+
+ if (isProcessEnabled(props, ProcessProperties.CLUSTER_CE_DISABLED)) {
+ commands.add(javaCommandFactory.createCeCommand(props, homeDir));
+ }
+
+ return commands;
+ }
}
}
diff --git a/sonar-application/src/main/java/org/sonar/application/JavaCommandFactoryImpl.java b/sonar-application/src/main/java/org/sonar/application/JavaCommandFactoryImpl.java
index 4f9ebd80ed8..8058beb1018 100644
--- a/sonar-application/src/main/java/org/sonar/application/JavaCommandFactoryImpl.java
+++ b/sonar-application/src/main/java/org/sonar/application/JavaCommandFactoryImpl.java
@@ -46,49 +46,49 @@ public class JavaCommandFactoryImpl implements JavaCommandFactory {
@Override
public JavaCommand createESCommand(Props props, File workDir) {
- return newJavaCommand(ProcessId.ELASTICSEARCH, props, workDir)
- .addJavaOptions("-Djava.awt.headless=true")
- .addJavaOptions(props.nonNullValue(ProcessProperties.SEARCH_JAVA_OPTS))
- .addJavaOptions(props.nonNullValue(ProcessProperties.SEARCH_JAVA_ADDITIONAL_OPTS))
- .setClassName("org.sonar.search.SearchServer")
- .addClasspath("./lib/common/*")
- .addClasspath("./lib/search/*");
- }
+ return newJavaCommand(ProcessId.ELASTICSEARCH, props, workDir)
+ .addJavaOptions("-Djava.awt.headless=true")
+ .addJavaOptions(props.nonNullValue(ProcessProperties.SEARCH_JAVA_OPTS))
+ .addJavaOptions(props.nonNullValue(ProcessProperties.SEARCH_JAVA_ADDITIONAL_OPTS))
+ .setClassName("org.sonar.search.SearchServer")
+ .addClasspath("./lib/common/*")
+ .addClasspath("./lib/search/*");
+ }
@Override
public JavaCommand createWebCommand(Props props, File workDir) {
- JavaCommand command = newJavaCommand(ProcessId.WEB_SERVER, props, workDir)
- .addJavaOptions(ProcessProperties.WEB_ENFORCED_JVM_ARGS)
- .addJavaOptions(props.nonNullValue(ProcessProperties.WEB_JAVA_OPTS))
- .addJavaOptions(props.nonNullValue(ProcessProperties.WEB_JAVA_ADDITIONAL_OPTS))
- // required for logback tomcat valve
- .setEnvVariable(ProcessProperties.PATH_LOGS, props.nonNullValue(ProcessProperties.PATH_LOGS))
- .setClassName("org.sonar.server.app.WebServer")
- .addClasspath("./lib/common/*")
- .addClasspath("./lib/server/*");
- String driverPath = props.value(ProcessProperties.JDBC_DRIVER_PATH);
- if (driverPath != null) {
- command.addClasspath(driverPath);
- }
- return command;
+ JavaCommand command = newJavaCommand(ProcessId.WEB_SERVER, props, workDir)
+ .addJavaOptions(ProcessProperties.WEB_ENFORCED_JVM_ARGS)
+ .addJavaOptions(props.nonNullValue(ProcessProperties.WEB_JAVA_OPTS))
+ .addJavaOptions(props.nonNullValue(ProcessProperties.WEB_JAVA_ADDITIONAL_OPTS))
+ // required for logback tomcat valve
+ .setEnvVariable(ProcessProperties.PATH_LOGS, props.nonNullValue(ProcessProperties.PATH_LOGS))
+ .setClassName("org.sonar.server.app.WebServer")
+ .addClasspath("./lib/common/*")
+ .addClasspath("./lib/server/*");
+ String driverPath = props.value(ProcessProperties.JDBC_DRIVER_PATH);
+ if (driverPath != null) {
+ command.addClasspath(driverPath);
}
+ return command;
+ }
@Override
public JavaCommand createCeCommand(Props props, File workDir) {
- JavaCommand command = newJavaCommand(ProcessId.COMPUTE_ENGINE, props, workDir)
- .addJavaOptions(ProcessProperties.CE_ENFORCED_JVM_ARGS)
- .addJavaOptions(props.nonNullValue(ProcessProperties.CE_JAVA_OPTS))
- .addJavaOptions(props.nonNullValue(ProcessProperties.CE_JAVA_ADDITIONAL_OPTS))
- .setClassName("org.sonar.ce.app.CeServer")
- .addClasspath("./lib/common/*")
- .addClasspath("./lib/server/*")
- .addClasspath("./lib/ce/*");
- String driverPath = props.value(ProcessProperties.JDBC_DRIVER_PATH);
- if (driverPath != null) {
- command.addClasspath(driverPath);
- }
- return command;
+ JavaCommand command = newJavaCommand(ProcessId.COMPUTE_ENGINE, props, workDir)
+ .addJavaOptions(ProcessProperties.CE_ENFORCED_JVM_ARGS)
+ .addJavaOptions(props.nonNullValue(ProcessProperties.CE_JAVA_OPTS))
+ .addJavaOptions(props.nonNullValue(ProcessProperties.CE_JAVA_ADDITIONAL_OPTS))
+ .setClassName("org.sonar.ce.app.CeServer")
+ .addClasspath("./lib/common/*")
+ .addClasspath("./lib/server/*")
+ .addClasspath("./lib/ce/*");
+ String driverPath = props.value(ProcessProperties.JDBC_DRIVER_PATH);
+ if (driverPath != null) {
+ command.addClasspath(driverPath);
}
+ return command;
+ }
private static JavaCommand newJavaCommand(ProcessId id, Props props, File workDir) {
JavaCommand command = new JavaCommand(id)