diff options
author | Stephane Gamard <stephane.gamard@searchbox.com> | 2014-07-21 14:37:37 +0200 |
---|---|---|
committer | Stephane Gamard <stephane.gamard@searchbox.com> | 2014-07-21 14:37:37 +0200 |
commit | b07f824fe45c5cea498c7170488b793c1f66e721 (patch) | |
tree | cdc7a5d81ce26aab5767c3b251badf9b8ad529e4 /server | |
parent | 9acf8d97bb5f49362a93eb20eb737ea94ecd3ea6 (diff) | |
download | sonarqube-b07f824fe45c5cea498c7170488b793c1f66e721.tar.gz sonarqube-b07f824fe45c5cea498c7170488b793c1f66e721.zip |
SONAR-5410 - Fixed process hang when child fails to start
Diffstat (limited to 'server')
3 files changed, 5 insertions, 4 deletions
diff --git a/server/sonar-process/src/main/java/org/sonar/process/Monitor.java b/server/sonar-process/src/main/java/org/sonar/process/Monitor.java index d321bce9dcb..a01a49e1745 100644 --- a/server/sonar-process/src/main/java/org/sonar/process/Monitor.java +++ b/server/sonar-process/src/main/java/org/sonar/process/Monitor.java @@ -102,7 +102,9 @@ public class Monitor extends Thread { try { Thread.sleep(1000); } catch (InterruptedException e) { - e.printStackTrace(); + LOGGER.warn("Monitoring thread has been interrupted. Closing"); + watch.cancel(true); + monitor.shutdownNow(); } } watch.cancel(true); diff --git a/server/sonar-process/src/main/java/org/sonar/process/Process.java b/server/sonar-process/src/main/java/org/sonar/process/Process.java index a18809168c6..045a5dcd0b9 100644 --- a/server/sonar-process/src/main/java/org/sonar/process/Process.java +++ b/server/sonar-process/src/main/java/org/sonar/process/Process.java @@ -129,6 +129,7 @@ public abstract class Process implements ProcessMXBean { throw new IllegalStateException("Process is not a compliant MBean", e); } + shutdownHook = new Thread(new Runnable() { @Override public void run() { @@ -183,7 +184,7 @@ public abstract class Process implements ProcessMXBean { try { shutdownHook.join(); } catch (InterruptedException e) { - e.printStackTrace(); + System.exit(-1); } } LOGGER.trace("Process[{}]::terminate() END", name); diff --git a/server/sonar-process/src/main/java/org/sonar/process/ProcessWrapper.java b/server/sonar-process/src/main/java/org/sonar/process/ProcessWrapper.java index 6a892569d74..2ec28711b70 100644 --- a/server/sonar-process/src/main/java/org/sonar/process/ProcessWrapper.java +++ b/server/sonar-process/src/main/java/org/sonar/process/ProcessWrapper.java @@ -254,8 +254,6 @@ public class ProcessWrapper extends Thread { if (this.processMXBean != null) { this.processMXBean.terminate(); waitUntilFinish(this); - } else { - process.destroy(); } } |