public class ShutdownHookManager
extends java.lang.Object
ShutdownHookManager
enables running shutdownHook
in a deterministic order, higher priority first.
The JVM runs ShutdownHooks in a non-deterministic order or in parallel.
This class registers a single JVM shutdownHook and run all the
shutdownHooks registered to it (to this class) in order based on their
priority.
Originally taken from o.a.hadoop.util.ShutdownHookManagerModifier and Type | Method and Description |
---|---|
static void |
addShutdownHook(java.lang.Runnable shutdownHook,
int priority)
Adds a shutdownHook with a priority, the higher the priority
the earlier will run.
|
static boolean |
hasShutdownHook(java.lang.Runnable shutdownHook)
Indicates if a shutdownHook is registered or not.
|
boolean |
hasShutdownHookInternal(java.lang.Runnable shutdownHook) |
static boolean |
isShutdownInProgress()
Indicates if shutdown is in progress or not.
|
static boolean |
removeShutdownHook(java.lang.Runnable shutdownHook)
Removes a shutdownHook.
|
public static void addShutdownHook(java.lang.Runnable shutdownHook, int priority)
shutdownHook
- shutdownHook Runnable
priority
- priority of the shutdownHook.public static boolean removeShutdownHook(java.lang.Runnable shutdownHook)
shutdownHook
- shutdownHook to remove.public static boolean hasShutdownHook(java.lang.Runnable shutdownHook)
shutdownHook
- shutdownHook to check if registered.public boolean hasShutdownHookInternal(java.lang.Runnable shutdownHook)
public static boolean isShutdownInProgress()
Copyright © 2012 The Apache Software Foundation