Enum Class ShutdownHook

java.lang.Object
java.lang.Enum<ShutdownHook>
org.eclipse.jgit.internal.util.ShutdownHook
All Implemented Interfaces:
Serializable, Comparable<ShutdownHook>, java.lang.constant.Constable

public enum ShutdownHook extends Enum<ShutdownHook>
A hook registered as a JVM shutdown hook managing a set of objects needing cleanup during JVM shutdown. See Runtime.addShutdownHook(java.lang.Thread).
  • Enum Constant Details

    • INSTANCE

      public static final ShutdownHook INSTANCE
      Singleton
  • Method Details

    • values

      public static ShutdownHook[] 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

      public static ShutdownHook valueOf(String name)
      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 name
      NullPointerException - if the argument is null
    • register

      public boolean register(ShutdownHook.Listener l)
      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 call ShutdownHook.Listener.onShutdown() on when JVM shuts down
      Returns:
      true if this object has been registered
    • unregister

      public boolean unregister(ShutdownHook.Listener l)
      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