public static void main(final String[] args) throws IOException {
    Configuration conf = HBaseConfiguration.create();
    String prop = System.getProperty(RUN_SHUTDOWN_HOOK);
    if (prop != null) {
      conf.setBoolean(RUN_SHUTDOWN_HOOK, Boolean.parseBoolean(prop));
    }
    // Instantiate a FileSystem. This will register the fs shutdown hook.
    FileSystem fs = FileSystem.get(conf);
    Thread donothing = new DoNothingThread();
    donothing.start();
    ShutdownHook.install(conf, fs, new DoNothingStoppable(), donothing);
  }
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.
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ShutdownHook.java