Class ShutdownHook
java.lang.Object
org.apache.hadoop.hbase.regionserver.ShutdownHook
Manage regionserver shutdown hooks.
-
Nested Class Summary
Modifier and TypeClassDescription(package private) static class
(package private) static class
private static class
-
Field Summary
Modifier and TypeFieldDescriptionprivate static final String
static final String
Key for a long configuration on how much time to wait on the fs shutdown hook.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 final org.slf4j.Logger
static final String
Key for boolean configuration whose default is true. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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 passedthreadToJoin
.static void
Main to test basic functionality.private static Runnable
suppressHdfsShutdownHook
(org.apache.hadoop.fs.FileSystem fs)
-
Field Details
-
LOG
-
CLIENT_FINALIZER_DATA_METHOD
- See Also:
-
RUN_SHUTDOWN_HOOK
Key for boolean configuration whose default is true.- See Also:
-
FS_SHUTDOWN_HOOK_WAIT
Key for a long configuration on how much time to wait on the fs shutdown hook. Default is 30 seconds.- See Also:
-
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. We keep track of the # of regionserver references in values of the map.
-
-
Constructor Details
-
ShutdownHook
public ShutdownHook()
-
-
Method Details
-
install
public 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 passedthreadToJoin
. 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 afterthreadToJoin
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
inConfiguration
tofalse
. This configuration value is checked when the hook code runs.- Parameters:
fs
- Instance of Filesystem used by the RegionServerstop
- Installed shutdown hook will call stop against this passedStoppable
instance.threadToJoin
- After calling stop onstop
will then join this thread.
-
suppressHdfsShutdownHook
-
main
Main to test basic functionality. Run with clean hadoop 0.20 and hadoop 0.21 and cloudera patched hadoop to make sure our shutdown hook handling works for all compbinations. Pass '-Dhbase.shutdown.hook=false' to test turning off the running of shutdown hooks.- Throws:
IOException
-