aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-process-monitor
diff options
context:
space:
mode:
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>2017-02-23 18:32:30 +0100
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>2017-02-24 21:14:15 +0100
commit132100250bc9dabdb0e28944e7d2f0e8629c6102 (patch)
tree08e608fa390d33e3fb9a55f7ebd92fe74d9ef45c /server/sonar-process-monitor
parentcfe7a59ac8d45c4d1d7def3923c67c5b48f70161 (diff)
downloadsonarqube-132100250bc9dabdb0e28944e7d2f0e8629c6102.tar.gz
sonarqube-132100250bc9dabdb0e28944e7d2f0e8629c6102.zip
SONAR-7937 restart reloads sonar.properties
but changes of FileSystem related properties are not supported and will make restart fail
Diffstat (limited to 'server/sonar-process-monitor')
-rw-r--r--server/sonar-process-monitor/src/main/java/org/sonar/process/monitor/Monitor.java16
1 files changed, 7 insertions, 9 deletions
diff --git a/server/sonar-process-monitor/src/main/java/org/sonar/process/monitor/Monitor.java b/server/sonar-process-monitor/src/main/java/org/sonar/process/monitor/Monitor.java
index 742aba3e86c..adb32e1c8a9 100644
--- a/server/sonar-process-monitor/src/main/java/org/sonar/process/monitor/Monitor.java
+++ b/server/sonar-process-monitor/src/main/java/org/sonar/process/monitor/Monitor.java
@@ -156,8 +156,7 @@ public class Monitor {
// start watching for restart requested by child process
restartWatcher.start();
- this.javaCommands = new ArrayList<>(commands);
- startProcesses();
+ startProcesses(() -> commands);
}
/**
@@ -171,14 +170,10 @@ public class Monitor {
return commands;
}
- private void reloadJavaCommands() {
- this.javaCommands = loadJavaCommands();
- }
-
/**
* Starts the processes defined by the JavaCommand in {@link #javaCommands}/
*/
- private void startProcesses() throws InterruptedException {
+ private void startProcesses(Supplier<List<JavaCommand>> javaCommandsSupplier) throws InterruptedException {
// do no start any child process if not in state INIT or RESTARTING (a stop could be in progress too)
if (lifecycle.tryToMoveTo(State.STARTING)) {
resetFileSystem();
@@ -189,6 +184,7 @@ public class Monitor {
hardStopWatcher.start();
}
+ this.javaCommands = javaCommandsSupplier.get();
startAndMonitorProcesses();
stopIfAnyProcessDidNotStart();
waitForOperationalProcesses();
@@ -385,12 +381,14 @@ public class Monitor {
public void run() {
stopProcesses();
try {
- reloadJavaCommands();
- startProcesses();
+ startProcesses(Monitor.this::loadJavaCommands);
} catch (InterruptedException e) {
// Startup was interrupted. Processes are being stopped asynchronously.
// Restoring the interruption state.
Thread.currentThread().interrupt();
+ } catch (Throwable t) {
+ LOG.error("Restart failed", t);
+ stopAsync(Lifecycle.State.HARD_STOPPING);
}
}
}