Class ShutdownHooks


  • public final 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.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.lang.Thread hook  
      private static java.util.List<ShutdownHooks.Task> tasks  
    • 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

      • 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)