Class ShutdownHooks

java.lang.Object
org.aesh.terminal.tty.utils.ShutdownHooks

public final class ShutdownHooks extends Object
Manages the shutdown-hook thread and tasks to execute on shutdown.
Author:
Jason Dillon
  • Method Details

    • add

      public static <T extends ShutdownHooks.Task> T add(T task)
      Adds a task to be executed on JVM shutdown. If this is the first task, a shutdown hook thread is registered.
      Type Parameters:
      T - the task type
      Parameters:
      task - the task to execute on shutdown
      Returns:
      the task that was added
    • remove

      public static void remove(ShutdownHooks.Task task)
      Removes a task from the shutdown hook. If no tasks remain, the shutdown hook thread is unregistered.
      Parameters:
      task - the task to remove