aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-application
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2014-07-30 17:05:26 +0200
committerSimon Brandhof <simon.brandhof@sonarsource.com>2014-07-30 17:05:26 +0200
commit374db617e2618defd69ab7b571f40a093b8f515d (patch)
tree7c1aa97b7f008e371c7fd75bb76821a637404242 /sonar-application
parent547e3117e69fefc314f8e395b29442fa5a324099 (diff)
downloadsonarqube-374db617e2618defd69ab7b571f40a093b8f515d.tar.gz
sonarqube-374db617e2618defd69ab7b571f40a093b8f515d.zip
SONAR-4898 fix reentrant master termination
Diffstat (limited to 'sonar-application')
-rw-r--r--sonar-application/src/main/java/org/sonar/application/App.java11
1 files changed, 8 insertions, 3 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 5d105718b19..642884d5cf4 100644
--- a/sonar-application/src/main/java/org/sonar/application/App.java
+++ b/sonar-application/src/main/java/org/sonar/application/App.java
@@ -31,7 +31,7 @@ public class App implements ProcessMXBean {
private final Installation installation;
- private final Monitor monitor = new Monitor();
+ private Monitor monitor = new Monitor();
private ProcessWrapper elasticsearch;
private ProcessWrapper server;
@@ -103,21 +103,26 @@ public class App implements ProcessMXBean {
@Override
public void terminate() {
LoggerFactory.getLogger(App.class).info("Stopping");
- if (monitor.isAlive()) {
+ if (monitor != null && monitor.isAlive()) {
monitor.terminate();
monitor.interrupt();
+ monitor = null;
}
if (server != null) {
server.terminate();
+ server = null;
}
if (elasticsearch != null) {
elasticsearch.terminate();
+ elasticsearch = null;
}
}
public static void main(String[] args) throws Exception {
Installation installation = new Installation();
new AppLogging().configure(installation);
- new App(installation).start();
+ App app = new App(installation);
+ app.start();
+ System.exit(0);
}
}