- All Implemented Interfaces:
Serializable
,Comparable<ShutdownHook>
,java.lang.constant.Constable
A hook registered as a JVM shutdown hook managing a set of objects needing
cleanup during JVM shutdown. See
Runtime.addShutdownHook(java.lang.Thread)
.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Object that needs to cleanup on JVM shutdown.Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionboolean
Whether a JVM shutdown is in progressboolean
Register object that needs cleanup during JVM shutdown if it is not already registered.boolean
Unregister object that no longer needs cleanup during JVM shutdown if it is still registered.static ShutdownHook
Returns the enum constant of this class with the specified name.static ShutdownHook[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
INSTANCE
Singleton
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
register
Register object that needs cleanup during JVM shutdown if it is not already registered. Registration is disabled when JVM shutdown is already in progress.- Parameters:
l
- the object to callShutdownHook.Listener.onShutdown()
on when JVM shuts down- Returns:
true
if this object has been registered
-
unregister
Unregister object that no longer needs cleanup during JVM shutdown if it is still registered. Unregistration is disabled when JVM shutdown is already in progress.- Parameters:
l
- the object registered to be notified for cleanup when the JVM shuts down- Returns:
true
if this object is no longer registered
-
isShutdownInProgress
public boolean isShutdownInProgress()Whether a JVM shutdown is in progress- Returns:
true
if a JVM shutdown is in progress
-