@InterfaceAudience.Private public class ShutdownHook extends Object
Modifier and Type | Field and Description |
---|---|
static String |
FS_SHUTDOWN_HOOK_WAIT
Key for a long configuration on how much time to wait on the fs shutdown
hook.
|
static String |
RUN_SHUTDOWN_HOOK
Key for boolean configuration whose default is true.
|
Constructor and Description |
---|
ShutdownHook() |
Modifier and Type | Method and Description |
---|---|
static void |
install(Configuration conf,
FileSystem fs,
Stoppable stop,
Thread threadToJoin)
Install a shutdown hook that calls stop on the passed Stoppable
and then thread joins against the passed
threadToJoin . |
static void |
main(String[] args)
Main to test basic functionality.
|
public static final String RUN_SHUTDOWN_HOOK
public static final String FS_SHUTDOWN_HOOK_WAIT
public static void install(Configuration conf, FileSystem fs, Stoppable stop, Thread threadToJoin)
threadToJoin
.
When this thread completes, it then runs the hdfs thread (This install
removes the hdfs shutdown hook keeping a handle on it to run it after
threadToJoin
has stopped).
To suppress all shutdown hook handling -- both the running of the
regionserver hook and of the hdfs hook code -- set
RUN_SHUTDOWN_HOOK
in Configuration
to
false
.
This configuration value is checked when the hook code runs.
conf
- fs
- Instance of Filesystem used by the RegionServerstop
- Installed shutdown hook will call stop against this passed
Stoppable
instance.threadToJoin
- After calling stop on stop
will then
join this thread.public static void main(String[] args) throws IOException
args
- IOException