diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 3b54c238b53..90c1ee87429 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -839,6 +839,9 @@ Release 2.8.0 - UNRELEASED HADOOP-11677. Add cookie flags for logs and static contexts. (nijel via wheat9) + HADOOP-12313. NPE in JvmPauseMonitor when calling stop() before start(). + (Gabor Liptak via wheat9) + Release 2.7.3 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/JvmPauseMonitor.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/JvmPauseMonitor.java index cd5afc652c8..73d730913bc 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/JvmPauseMonitor.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/JvmPauseMonitor.java @@ -78,12 +78,16 @@ public class JvmPauseMonitor { Preconditions.checkState(monitorThread == null, "Already started"); monitorThread = new Daemon(new Monitor()); - monitorThread.start(); + if (shouldRun) { + monitorThread.start(); + } else { + LOG.warn("stop() was called before start() completed"); + } } public void stop() { shouldRun = false; - if (monitorThread != null) { + if (isStarted()) { monitorThread.interrupt(); try { monitorThread.join();