@InterfaceAudience.Private public class ShutdownHook extends Object
Modifier and Type | Class and Description |
---|---|
(package private) static class |
ShutdownHook.DoNothingStoppable |
(package private) static class |
ShutdownHook.DoNothingThread |
private static class |
ShutdownHook.ShutdownHookThread |
Modifier and Type | Field and Description |
---|---|
private static String |
CLIENT_FINALIZER_DATA_METHOD |
static String |
FS_SHUTDOWN_HOOK_WAIT
Key for a long configuration on how much time to wait on the fs shutdown
hook.
|
private static Map<Runnable,Integer> |
fsShutdownHooks
A place for keeping track of all the filesystem shutdown hooks that need
to be executed after the last regionserver referring to a given filesystem
stops.
|
private static org.slf4j.Logger |
LOG |
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(org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.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.
|
private static Runnable |
suppressHdfsShutdownHook(org.apache.hadoop.fs.FileSystem fs) |
private static final org.slf4j.Logger LOG
private static final String CLIENT_FINALIZER_DATA_METHOD
public static final String RUN_SHUTDOWN_HOOK
public static final String FS_SHUTDOWN_HOOK_WAIT
private static final Map<Runnable,Integer> fsShutdownHooks
public ShutdownHook()
public static void install(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.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.private static Runnable suppressHdfsShutdownHook(org.apache.hadoop.fs.FileSystem fs)
public static void main(String[] args) throws IOException
args
- IOException
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.