HADOOP-12423. Handle failure of registering shutdownhook by ShutdownHookManager in static block (Contributed by Abhishek Agarwal)
(cherry picked from commit 446987e20a
)
This commit is contained in:
parent
845acfd96c
commit
c13929b385
|
@ -1000,6 +1000,9 @@ Release 2.8.0 - UNRELEASED
|
|||
HADOOP-12356. Fix computing CPU usage statistics on Windows.
|
||||
(Inigo Goiri via wangda)
|
||||
|
||||
HADOOP-12423. Handle failure of registering shutdownhook by
|
||||
ShutdownHookManager in static block (Abhishek Agarwal via vinayakumarb)
|
||||
|
||||
Release 2.7.3 - UNRELEASED
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
|
|
@ -44,6 +44,7 @@ public class ShutdownHookManager {
|
|||
private static final Log LOG = LogFactory.getLog(ShutdownHookManager.class);
|
||||
|
||||
static {
|
||||
try {
|
||||
Runtime.getRuntime().addShutdownHook(
|
||||
new Thread() {
|
||||
@Override
|
||||
|
@ -60,6 +61,10 @@ public class ShutdownHookManager {
|
|||
}
|
||||
}
|
||||
);
|
||||
} catch (IllegalStateException ex) {
|
||||
// JVM is being shut down. Ignore
|
||||
LOG.warn("Failed to add the ShutdownHook", ex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue