Class ShutdownHooks


  • public class ShutdownHooks
    extends java.lang.Object
    Provides an api for adding shutdown hooks. This exists because there is no Runtime.addShutdownHook(java.lang.Thread) implementation available on scala.js. The hooks may be added with a priority that controls the order in which the hooks run. Lower values run first.
    • Constructor Summary

      Constructors 
      Constructor Description
      ShutdownHooks()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int addHook​(int priority, java.lang.Runnable runnable)
      Add a removable hook to run at shutdown.
      static void removeHook​(int id)
      Remove a shutdown hook that was added via addHook(int, Runnable).
      • Methods inherited from class java.lang.Object

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

      • ShutdownHooks

        public ShutdownHooks()
    • Method Detail

      • addHook

        public static int addHook​(int priority,
                                  java.lang.Runnable runnable)
        Add a removable hook to run at shutdown.
        Parameters:
        priority - controls the ordering of this hook. Lower values run first.
        runnable - the shutdown task to run
        Returns:
        an id that can be used to later remove the runnable if it is no longer needed.