Enum Class ShutdownHook

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

public enum ShutdownHook extends Enum<ShutdownHook>
The singleton ShutdownHook provides a means to register ShutdownHook.Listeners that are run when JGit is uninstalled, either
  • in an OSGi framework when this bundle is deactivated, or
  • otherwise, when the JVM as a whole shuts down.
  • 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 JGit shutdown if it is not already registered. Registration is disabled when JGit shutdown is already in progress.
      Parameters:
      l - the object to call ShutdownHook.Listener.onShutdown() on when JGit 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 JGit shutdown if it is still registered. Unregistration is disabled when JGit 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 JGit shutdown is in progress
      Returns:
      true if a JGit shutdown is in progress