Class ShutdownHook

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

@Private public class ShutdownHook extends Object
Manage regionserver shutdown hooks.
See Also:
  • Field Details

  • Constructor Details

  • 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 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:
      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.
    • suppressHdfsShutdownHook

      private static Runnable suppressHdfsShutdownHook(org.apache.hadoop.fs.FileSystem fs)
    • 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.
      Throws:
      IOException