aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-application
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2014-09-21 21:22:59 +0200
committerSimon Brandhof <simon.brandhof@sonarsource.com>2014-09-21 21:27:19 +0200
commitbbca1b8de515423e6fd0d7e93e0d2f49e82dd7ba (patch)
treee07194d1fa98865db4ffff2cc86e5a552ad74f53 /sonar-application
parent9999a96f4b0cbb345cd4690ebc37452ff624e1d5 (diff)
downloadsonarqube-bbca1b8de515423e6fd0d7e93e0d2f49e82dd7ba.tar.gz
sonarqube-bbca1b8de515423e6fd0d7e93e0d2f49e82dd7ba.zip
SONAR-4898 drop RMI and autokill
Diffstat (limited to 'sonar-application')
-rw-r--r--sonar-application/src/main/assembly/conf/sonar.properties9
-rw-r--r--sonar-application/src/main/java/org/sonar/application/App.java27
-rw-r--r--sonar-application/src/main/java/org/sonar/application/DefaultSettings.java4
-rw-r--r--sonar-application/src/test/java/org/sonar/application/DefaultSettingsTest.java6
4 files changed, 5 insertions, 41 deletions
diff --git a/sonar-application/src/main/assembly/conf/sonar.properties b/sonar-application/src/main/assembly/conf/sonar.properties
index 8cae11e3cca..f14700b3592 100644
--- a/sonar-application/src/main/assembly/conf/sonar.properties
+++ b/sonar-application/src/main/assembly/conf/sonar.properties
@@ -69,11 +69,6 @@ sonar.jdbc.timeBetweenEvictionRunsMillis=30000
#sonar.web.javaOpts=-Xmx768m -XX:MaxPermSize=160m -XX:+HeapDumpOnOutOfMemoryError \
# -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djruby.management.enabled=false
-# Web server requires a JMX RMI port to be open. Default is 9003. A free port is
-# dynamically used is value is 0.
-# This JMX port must be private and must not be exposed to the Internet.
-#sonar.web.jmxPort=9003
-
# 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.
@@ -182,10 +177,6 @@ sonar.jdbc.timeBetweenEvictionRunsMillis=30000
# This port must be private and must not be exposed to the Internet.
#sonar.search.port=9001
-# JMX RMI port to monitor Elasticsearch process. Default is 9002. Use 0 to get a free port.
-# It must be private and must not be exposed to the Internet.
-#sonar.search.jmxPort=9002
-
#--------------------------------------------------------------------------------------------------
# UPDATE CENTER
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 600828ec1db..db1f9fcb5f6 100644
--- a/sonar-application/src/main/java/org/sonar/application/App.java
+++ b/sonar-application/src/main/java/org/sonar/application/App.java
@@ -21,12 +21,9 @@ package org.sonar.application;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang.StringUtils;
-import org.sonar.process.JmxUtils;
import org.sonar.process.MinimumViableSystem;
import org.sonar.process.ProcessLogging;
-import org.sonar.process.ProcessMXBean;
import org.sonar.process.Props;
-import org.sonar.process.State;
import org.sonar.process.monitor.JavaCommand;
import org.sonar.process.monitor.Monitor;
@@ -38,7 +35,7 @@ import java.util.Properties;
/**
* Entry-point of process that starts and monitors elasticsearch and web servers
*/
-public class App implements ProcessMXBean {
+public class App {
private final Monitor monitor;
@@ -48,7 +45,6 @@ public class App implements ProcessMXBean {
App(Monitor monitor) {
this.monitor = monitor;
- JmxUtils.registerMBean(this, "SonarQube");
}
public void start(Props props) {
@@ -60,10 +56,9 @@ public class App implements ProcessMXBean {
List<JavaCommand> commands = new ArrayList<JavaCommand>();
File homeDir = props.nonNullValueAsFile("sonar.path.home");
File tempDir = props.nonNullValueAsFile("sonar.path.temp");
- JavaCommand elasticsearch = new JavaCommand(JmxUtils.SEARCH_SERVER_NAME);
+ JavaCommand elasticsearch = new JavaCommand("search");
elasticsearch
.setWorkDir(homeDir)
- .setJmxPort(props.valueAsInt(DefaultSettings.SEARCH_JMX_PORT))
.addJavaOptions(props.value(DefaultSettings.SEARCH_JAVA_OPTS))
.setTempDir(tempDir.getAbsoluteFile())
.setClassName("org.sonar.search.SearchServer")
@@ -74,9 +69,8 @@ public class App implements ProcessMXBean {
// do not yet start SQ in cluster mode. See SONAR-5483 & SONAR-5391
if (StringUtils.isEmpty(props.value(DefaultSettings.CLUSTER_MASTER))) {
- JavaCommand webServer = new JavaCommand(JmxUtils.WEB_SERVER_NAME)
+ JavaCommand webServer = new JavaCommand("web")
.setWorkDir(homeDir)
- .setJmxPort(props.valueAsInt(DefaultSettings.WEB_JMX_PORT))
.addJavaOptions(props.nonNullValue(DefaultSettings.WEB_JAVA_OPTS))
.setTempDir(tempDir.getAbsoluteFile())
// required for logback tomcat valve
@@ -94,21 +88,6 @@ public class App implements ProcessMXBean {
return commands;
}
- @Override
- public void terminate() {
- monitor.stop();
- }
-
- @Override
- public boolean isReady() {
- return monitor.getState() == State.STARTED;
- }
-
- @Override
- public void ping() {
-
- }
-
static String starPath(File homeDir, String relativePath) {
File dir = new File(homeDir, relativePath);
return FilenameUtils.concat(dir.getAbsolutePath(), "*");
diff --git a/sonar-application/src/main/java/org/sonar/application/DefaultSettings.java b/sonar-application/src/main/java/org/sonar/application/DefaultSettings.java
index b18d0b633b2..701249f5f63 100644
--- a/sonar-application/src/main/java/org/sonar/application/DefaultSettings.java
+++ b/sonar-application/src/main/java/org/sonar/application/DefaultSettings.java
@@ -35,9 +35,7 @@ class DefaultSettings {
static final String CLUSTER_NAME = "sonar.cluster.name";
static final String CLUSTER_NODE_NAME = "sonar.node.name";
static final String SEARCH_PORT = "sonar.search.port";
- static final String SEARCH_JMX_PORT = "sonar.search.jmxPort";
static final String SEARCH_JAVA_OPTS = "sonar.search.javaOpts";
- static final String WEB_JMX_PORT = "sonar.web.jmxPort";
static final String WEB_JAVA_OPTS = "sonar.web.javaOpts";
static final String JDBC_URL = "sonar.jdbc.url";
static final String JDBC_LOGIN = "sonar.jdbc.username";
@@ -84,8 +82,6 @@ class DefaultSettings {
private static Map<String, Integer> defaultPorts() {
Map<String, Integer> defaults = new HashMap<String, Integer>();
defaults.put(SEARCH_PORT, 9001);
- defaults.put(SEARCH_JMX_PORT, 9002);
- defaults.put(WEB_JMX_PORT, 9003);
return defaults;
}
}
diff --git a/sonar-application/src/test/java/org/sonar/application/DefaultSettingsTest.java b/sonar-application/src/test/java/org/sonar/application/DefaultSettingsTest.java
index 16a9cc9f1f8..11bcb2f5631 100644
--- a/sonar-application/src/test/java/org/sonar/application/DefaultSettingsTest.java
+++ b/sonar-application/src/test/java/org/sonar/application/DefaultSettingsTest.java
@@ -34,8 +34,6 @@ public class DefaultSettingsTest {
DefaultSettings.init(props);
assertThat(props.value("sonar.search.javaOpts")).contains("-Xmx");
- assertThat(props.valueAsInt("sonar.web.jmxPort")).isEqualTo(9003);
- assertThat(props.valueAsInt("sonar.search.jmxPort")).isEqualTo(9002);
assertThat(props.value("sonar.jdbc.username")).isEqualTo("sonar");
}
@@ -52,10 +50,10 @@ public class DefaultSettingsTest {
@Test
public void use_random_port_if_zero() throws Exception {
Properties p = new Properties();
- p.setProperty("sonar.search.jmxPort", "0");
+ p.setProperty("sonar.search.port", "0");
Props props = new Props(p);
DefaultSettings.init(props);
- assertThat(props.valueAsInt("sonar.web.jmxPort")).isGreaterThan(0);
+ assertThat(props.valueAsInt("sonar.search.port")).isGreaterThan(0);
}
}