HADOOP-12313. NPE in JvmPauseMonitor when calling stop() before start(). Contributed by Gabor Liptak.
This commit is contained in:
parent
c07fab5f6f
commit
f826195ee5
|
@ -839,6 +839,9 @@ Release 2.8.0 - UNRELEASED
|
||||||
HADOOP-11677. Add cookie flags for logs and static contexts.
|
HADOOP-11677. Add cookie flags for logs and static contexts.
|
||||||
(nijel via wheat9)
|
(nijel via wheat9)
|
||||||
|
|
||||||
|
HADOOP-12313. NPE in JvmPauseMonitor when calling stop() before start().
|
||||||
|
(Gabor Liptak via wheat9)
|
||||||
|
|
||||||
Release 2.7.3 - UNRELEASED
|
Release 2.7.3 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -78,12 +78,16 @@ public class JvmPauseMonitor {
|
||||||
Preconditions.checkState(monitorThread == null,
|
Preconditions.checkState(monitorThread == null,
|
||||||
"Already started");
|
"Already started");
|
||||||
monitorThread = new Daemon(new Monitor());
|
monitorThread = new Daemon(new Monitor());
|
||||||
|
if (shouldRun) {
|
||||||
monitorThread.start();
|
monitorThread.start();
|
||||||
|
} else {
|
||||||
|
LOG.warn("stop() was called before start() completed");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stop() {
|
public void stop() {
|
||||||
shouldRun = false;
|
shouldRun = false;
|
||||||
if (monitorThread != null) {
|
if (isStarted()) {
|
||||||
monitorThread.interrupt();
|
monitorThread.interrupt();
|
||||||
try {
|
try {
|
||||||
monitorThread.join();
|
monitorThread.join();
|
||||||
|
|
Loading…
Reference in New Issue