From 28c9c5354566365afb1c865a30af1ce4e36075b0 Mon Sep 17 00:00:00 2001 From: Stephane Gamard Date: Fri, 29 Aug 2014 17:52:14 +0200 Subject: [PATCH] SONAR-4898 - forgot a synchronized for JSW --- .../org/sonar/process/MonitoredProcess.java | 34 +++++++++---------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/server/process/sonar-process/src/main/java/org/sonar/process/MonitoredProcess.java b/server/process/sonar-process/src/main/java/org/sonar/process/MonitoredProcess.java index c1c5d172c4a..5ad365ee338 100644 --- a/server/process/sonar-process/src/main/java/org/sonar/process/MonitoredProcess.java +++ b/server/process/sonar-process/src/main/java/org/sonar/process/MonitoredProcess.java @@ -123,25 +123,23 @@ public abstract class MonitoredProcess implements ProcessMXBean { } @Override - public final void terminate() { - synchronized (monitor) { - if (monitor != null) { - LOGGER.debug("Process[{}] terminating", name); - 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; + public final synchronized void terminate() { + if (monitor != null) { + LOGGER.debug("Process[{}] terminating", name); + 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; } } -- 2.39.5