Class ShutdownHookManager

Object
org.apache.spark.util.ShutdownHookManager

public class ShutdownHookManager extends Object
Various utility methods used by Spark.
  • Constructor Details

    • ShutdownHookManager

      public ShutdownHookManager()
  • Method Details

    • DEFAULT_SHUTDOWN_PRIORITY

      public static int DEFAULT_SHUTDOWN_PRIORITY()
    • SPARK_CONTEXT_SHUTDOWN_PRIORITY

      public static int SPARK_CONTEXT_SHUTDOWN_PRIORITY()
      The shutdown priority of the SparkContext instance. This is lower than the default priority, so that by default hooks are run before the context is shut down.
      Returns:
      (undocumented)
    • TEMP_DIR_SHUTDOWN_PRIORITY

      public static int TEMP_DIR_SHUTDOWN_PRIORITY()
      The shutdown priority of temp directory must be lower than the SparkContext shutdown priority. Otherwise cleaning the temp directories while Spark jobs are running can throw undesirable errors at the time of shutdown.
      Returns:
      (undocumented)
    • registerShutdownDeleteDir

      public static void registerShutdownDeleteDir(File file)
    • removeShutdownDeleteDir

      public static void removeShutdownDeleteDir(File file)
    • hasShutdownDeleteDir

      public static boolean hasShutdownDeleteDir(File file)
    • hasRootAsShutdownDeleteDir

      public static boolean hasRootAsShutdownDeleteDir(File file)
    • inShutdown

      public static boolean inShutdown()
      Detect whether this thread might be executing a shutdown hook. Will always return true if the current thread is a running a shutdown hook but may spuriously return true otherwise (e.g. if System.exit was just called by a concurrent thread).

      Currently, this detects whether the JVM is shutting down by Runtime#addShutdownHook throwing an IllegalStateException.

      Returns:
      (undocumented)
    • addShutdownHook

      public static Object addShutdownHook(scala.Function0<scala.runtime.BoxedUnit> hook)
      Adds a shutdown hook with default priority.

      Parameters:
      hook - The code to run during shutdown.
      Returns:
      A handle that can be used to unregister the shutdown hook.
    • addShutdownHook

      public static Object addShutdownHook(int priority, scala.Function0<scala.runtime.BoxedUnit> hook)
      Adds a shutdown hook with the given priority. Hooks with higher priority values run first.

      Parameters:
      hook - The code to run during shutdown.
      priority - (undocumented)
      Returns:
      A handle that can be used to unregister the shutdown hook.
    • removeShutdownHook

      public static boolean removeShutdownHook(Object ref)
      Remove a previously installed shutdown hook.

      Parameters:
      ref - A handle returned by addShutdownHook.
      Returns:
      Whether the hook was removed.
    • org$apache$spark$internal$Logging$$log_

      public static org.slf4j.Logger org$apache$spark$internal$Logging$$log_()
    • org$apache$spark$internal$Logging$$log__$eq

      public static void org$apache$spark$internal$Logging$$log__$eq(org.slf4j.Logger x$1)