]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-4898 do not remove the autokill monitor before trying to stop app
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Thu, 28 Aug 2014 09:12:42 +0000 (11:12 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Thu, 28 Aug 2014 09:21:29 +0000 (11:21 +0200)
server/process/sonar-process/src/main/java/org/sonar/process/MonitoredProcess.java

index 5f0c03bea7a95eb413944a7ba7d000f381ba0def..c36df449b9e0321c7322eb3e71fcaf36ed6a9719 100644 (file)
@@ -126,18 +126,18 @@ public abstract class MonitoredProcess implements ProcessMXBean {
   public final void terminate() {
     if (monitor != null) {
       LOGGER.debug("Process[{}] terminating", name);
-      monitor.shutdownNow();
-      monitor = null;
-      if (pingTask != null) {
-        pingTask.cancel(true);
-        pingTask = null;
-      }
       try {
         doTerminate();
       } catch (Exception e) {
         LOGGER.error("Fail to terminate " + name, e);
         // do not propagate exception
       }
+      monitor.shutdownNow();
+      monitor = null;
+      if (pingTask != null) {
+        pingTask.cancel(true);
+        pingTask = null;
+      }
       LOGGER.debug("Process[{}] terminated", name);
       terminated = true;
     }