fi
cd sonarqube-*
-java -jar ./lib/sonar-application*.jar -Dsonar.web.javaOpts=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005
\ No newline at end of file
+java -jar ./lib/sonar-application*.jar -Dsonar.web.javaAdditionalOpts=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005
*/
package org.sonar.process.monitor;
+import org.apache.commons.lang.StringUtils;
+
import javax.annotation.Nullable;
import java.io.File;
}
public JavaCommand addJavaOption(String s) {
- javaOptions.add(s);
+ if (StringUtils.isNotBlank(s)) {
+ javaOptions.add(s);
+ }
return this;
}
public JavaCommand addJavaOptions(String s) {
- Collections.addAll(javaOptions, s.split(" "));
+ for (String opt : s.split(" ")) {
+ addJavaOption(opt);
+ }
return this;
}
}
@Test
- public void split_java_options() throws Exception {
+ public void add_java_options() throws Exception {
JavaCommand command = new JavaCommand("foo");
+ assertThat(command.getJavaOptions()).isEmpty();
+
+ command.addJavaOptions("");
+ assertThat(command.getJavaOptions()).isEmpty();
+
command.addJavaOptions("-Xmx512m -Xms256m -Dfoo");
assertThat(command.getJavaOptions()).containsOnly("-Xmx512m", "-Xms256m", "-Dfoo");
}
#sonar.web.javaOpts=-Xmx768m -XX:MaxPermSize=160m -XX:+HeapDumpOnOutOfMemoryError \
# -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djruby.management.enabled=false
+# Same as previous property, but allows to not repeat all settings like -Djava.awt.headless=true
+#sonar.web.javaAdditionalOpts=
+
# Binding IP address. For servers with more than one IP address, this property specifies which
# address will be used for listening on the specified ports.
# By default, ports will be used on all IP addresses associated with the server.
# -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError \
# -Djava.awt.headless=true
+# Same as previous property, but allows to not repeat all settings like -Djava.awt.headless=true
+#sonar.search.javaAdditionalOpts=
+
# Elasticsearch port. Default is 9001. Use 0 to get a free port.
# This port must be private and must not be exposed to the Internet.
#sonar.search.port=9001
JavaCommand elasticsearch = new JavaCommand("search");
elasticsearch
.setWorkDir(homeDir)
- .addJavaOptions(props.value(DefaultSettings.SEARCH_JAVA_OPTS))
+ .addJavaOptions(props.nonNullValue(DefaultSettings.SEARCH_JAVA_OPTS))
+ .addJavaOptions(props.nonNullValue(DefaultSettings.SEARCH_JAVA_ADDITIONAL_OPTS))
.setTempDir(tempDir.getAbsoluteFile())
.setClassName("org.sonar.search.SearchServer")
.setArguments(props.rawProperties())
JavaCommand webServer = new JavaCommand("web")
.setWorkDir(homeDir)
.addJavaOptions(props.nonNullValue(DefaultSettings.WEB_JAVA_OPTS))
+ .addJavaOptions(props.nonNullValue(DefaultSettings.WEB_JAVA_ADDITIONAL_OPTS))
.setTempDir(tempDir.getAbsoluteFile())
// required for logback tomcat valve
.setEnvVariable("sonar.path.logs", props.nonNullValue("sonar.path.logs"))
static final String CLUSTER_NODE_NAME = "sonar.node.name";
static final String SEARCH_PORT = "sonar.search.port";
static final String SEARCH_JAVA_OPTS = "sonar.search.javaOpts";
+ static final String SEARCH_JAVA_ADDITIONAL_OPTS = "sonar.search.javaAdditionalOpts";
static final String WEB_JAVA_OPTS = "sonar.web.javaOpts";
+ static final String WEB_JAVA_ADDITIONAL_OPTS = "sonar.web.javaAdditionalOpts";
static final String JDBC_URL = "sonar.jdbc.url";
static final String JDBC_LOGIN = "sonar.jdbc.username";
static final String JDBC_PASSWORD = "sonar.jdbc.password";
defaults.put(SEARCH_JAVA_OPTS, "-Xmx256m -Xms256m -Xss256k -Djava.net.preferIPv4Stack=true " +
"-XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly " +
"-XX:+HeapDumpOnOutOfMemoryError -Djava.awt.headless=true");
+ defaults.put(SEARCH_JAVA_ADDITIONAL_OPTS, "");
defaults.put(CLUSTER_NODE_NAME, "sonar-" + System.currentTimeMillis());
defaults.put(WEB_JAVA_OPTS, "-Xmx768m -XX:MaxPermSize=160m -XX:+HeapDumpOnOutOfMemoryError -Djava.net.preferIPv4Stack=true " +
"-Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djruby.management.enabled=false");
+ defaults.put(WEB_JAVA_ADDITIONAL_OPTS, "");
defaults.put(JDBC_URL, "jdbc:h2:tcp://localhost:9092/sonar");
defaults.put(JDBC_LOGIN, "sonar");
defaults.put(JDBC_PASSWORD, "sonar");