Class ShutdownHooks


  • public class ShutdownHooks
    extends java.lang.Object
    Manages the JLine shutdown-hook thread and tasks to execute on shutdown.
    Since:
    2.7
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  ShutdownHooks.Task
      Essentially a Runnable which allows running to throw an exception.
    • Constructor Summary

      Constructors 
      Constructor Description
      ShutdownHooks()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T extends ShutdownHooks.Task>
      T
      add​(T task)  
      private static java.lang.Thread addHook​(java.lang.Thread thread)  
      static void remove​(ShutdownHooks.Task task)  
      private static void removeHook​(java.lang.Thread thread)  
      private static void runTasks()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • JLINE_SHUTDOWNHOOK

        public static final java.lang.String JLINE_SHUTDOWNHOOK
        See Also:
        Constant Field Values
      • enabled

        private static final boolean enabled
      • hook

        private static java.lang.Thread hook
    • Constructor Detail

      • ShutdownHooks

        public ShutdownHooks()
    • Method Detail

      • runTasks

        private static void runTasks()
      • addHook

        private static java.lang.Thread addHook​(java.lang.Thread thread)
      • removeHook

        private static void removeHook​(java.lang.Thread thread)