diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2014-09-22 22:59:26 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2014-09-22 22:59:26 +0200 |
commit | f5024838e3c51f1beb2a37180a280cbde5582d30 (patch) | |
tree | 4d4f0a35a76588b34e3c2b2ee997e6fb40b9a768 /sonar-application | |
parent | 449507e3254f712f91e7d5db843b08606b6eff02 (diff) | |
parent | f00cda378e649a87b2b1693db5aaaec37461a481 (diff) | |
download | sonarqube-f5024838e3c51f1beb2a37180a280cbde5582d30.tar.gz sonarqube-f5024838e3c51f1beb2a37180a280cbde5582d30.zip |
Merge remote-tracking branch 'origin/branch-4.5'
Diffstat (limited to 'sonar-application')
-rw-r--r-- | sonar-application/src/main/java/org/sonar/application/App.java | 16 |
1 files changed, 15 insertions, 1 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 db1f9fcb5f6..c051e2f1c8d 100644 --- a/sonar-application/src/main/java/org/sonar/application/App.java +++ b/sonar-application/src/main/java/org/sonar/application/App.java @@ -22,8 +22,11 @@ package org.sonar.application; import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang.StringUtils; import org.sonar.process.MinimumViableSystem; +import org.sonar.process.ProcessCommands; import org.sonar.process.ProcessLogging; import org.sonar.process.Props; +import org.sonar.process.StopWatcher; +import org.sonar.process.Stoppable; import org.sonar.process.monitor.JavaCommand; import org.sonar.process.monitor.Monitor; @@ -35,7 +38,7 @@ import java.util.Properties; /** * Entry-point of process that starts and monitors elasticsearch and web servers */ -public class App { +public class App implements Stoppable { private final Monitor monitor; @@ -48,6 +51,12 @@ public class App { } public void start(Props props) { + if (props.valueAsBoolean("sonar.enableStopCommand", false)) { + // stop application when file <temp>/app.stop is created + File tempDir = props.nonNullValueAsFile("sonar.path.temp"); + ProcessCommands commands = new ProcessCommands(tempDir, "app"); + new StopWatcher(commands, this).start(); + } monitor.start(createCommands(props)); monitor.awaitTermination(); } @@ -103,4 +112,9 @@ public class App { App app = new App(); app.start(props); } + + @Override + public void stopAsync() { + monitor.stopAsync(); + } } |