org.apache.hadoop.hbase.regionserver
Class ShutdownHook

java.lang.Object
  extended by org.apache.hadoop.hbase.regionserver.ShutdownHook

@InterfaceAudience.Private
public class ShutdownHook
extends Object

Manage regionserver shutdown hooks.

See Also:
install(Configuration, FileSystem, Stoppable, Thread)

Field Summary
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 Summary
ShutdownHook()
           
 
Method Summary
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RUN_SHUTDOWN_HOOK

public static final String RUN_SHUTDOWN_HOOK
Key for boolean configuration whose default is true.

See Also:
Constant Field Values

FS_SHUTDOWN_HOOK_WAIT

public static final String 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:
Constant Field Values
Constructor Detail

ShutdownHook

public ShutdownHook()
Method Detail

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 passed 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.

Parameters:
conf -
fs - Instance of Filesystem used by the RegionServer
stop - Installed shutdown hook will call stop against this passed Stoppable instance.
threadToJoin - After calling stop on stop will then join this thread.

main

public static void main(String[] args)
                 throws IOException
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.

Parameters:
args -
Throws:
IOException


Copyright © 2007–2016 The Apache Software Foundation. All rights reserved.