framework/oryx-lambda/src/main/java/com/cloudera/oryx/lambda/HadoopUtils.java
public static void closeAtShutdown(Closeable closeable) {
    if (SHUTDOWN_HOOK.addCloseable(closeable)) {
      try {
        // Spark uses SHUTDOWN_HOOK_PRIORITY + 30; this tries to execute earlier
        ShutdownHookManager.get().addShutdownHook(SHUTDOWN_HOOK, FileSystem.SHUTDOWN_HOOK_PRIORITY + 40);
      } catch (IllegalStateException ise) {
        log.warn("Can't close {} at shutdown since shutdown is in progress", closeable);
      }
    }
  }
public static void closeAtShutdown(Closeable closeable) {
    if (SHUTDOWN_HOOK.addCloseable(closeable)) {
      try {
        // Spark uses SHUTDOWN_HOOK_PRIORITY + 30; this tries to execute earlier
        ShutdownHookManager.get().addShutdownHook(SHUTDOWN_HOOK, FileSystem.SHUTDOWN_HOOK_PRIORITY + 40);
      } catch (IllegalStateException ise) {
        log.warn("Can't close {} at shutdown since shutdown is in progress", closeable);
      }
    }
  }
public static void closeAtShutdown ( Closeable closeable ) { if ( SHUTDOWN_HOOK . addCloseable ( closeable ) ) { try { // Spark uses SHUTDOWN_HOOK_PRIORITY + 30; this tries to execute earlier ShutdownHookManager . get ( ) . addShutdownHook ( SHUTDOWN_HOOK , FileSystem . SHUTDOWN_HOOK_PRIORITY + 40 ) ; } catch ( IllegalStateException ise ) { log . warn ( "Can't close {} at shutdown since shutdown is in progress" , closeable ) ; } } }
Adds a shutdown hook that tries to call {@link Closeable#close()} on the given argument
at JVM shutdown. This integrates with Hadoop's {@link ShutdownHookManager} in order to
better interact with Spark's usage of the same.

@param closeable thing to close
Adds a shutdown hook that tries to call { @link Closeable#close () } on the given argument at JVM shutdown . This integrates with Hadoop s { @link ShutdownHookManager } in order to better interact with Spark s usage of the same .