Package org.apache.spark.util
Class ShutdownHookManager
Object
org.apache.spark.util.ShutdownHookManager
Various utility methods used by Spark.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Object
addShutdownHook
(int priority, scala.Function0<scala.runtime.BoxedUnit> hook) Adds a shutdown hook with the given priority.static Object
addShutdownHook
(scala.Function0<scala.runtime.BoxedUnit> hook) Adds a shutdown hook with default priority.static int
static boolean
static boolean
hasShutdownDeleteDir
(File file) static boolean
Detect whether this thread might be executing a shutdown hook.static org.apache.spark.internal.Logging.LogStringContext
LogStringContext
(scala.StringContext sc) static org.slf4j.Logger
static void
org$apache$spark$internal$Logging$$log__$eq
(org.slf4j.Logger x$1) static void
static void
removeShutdownDeleteDir
(File file) static boolean
removeShutdownHook
(Object ref) Remove a previously installed shutdown hook.static int
The shutdown priority of the SparkContext instance.static int
The shutdown priority of temp directory must be lower than the SparkContext shutdown priority.
-
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
-
removeShutdownDeleteDir
-
hasShutdownDeleteDir
-
hasRootAsShutdownDeleteDir
-
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
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
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
Remove a previously installed shutdown hook.- Parameters:
ref
- A handle returned byaddShutdownHook
.- 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) -
LogStringContext
public static org.apache.spark.internal.Logging.LogStringContext LogStringContext(scala.StringContext sc)
-