Class ShutdownOperations


  • public class ShutdownOperations
    extends java.lang.Object
    Operations that should be executed on shutdown.
    Since:
    2.0
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void addOperation​(java.lang.Runnable runnable)
      Adds a shutdown operation which will be run once for the next shutdown
      static void addOperation​(java.lang.Runnable runnable, boolean preserveForNextShutdown)
      Adds a shutdown operation
      static void resetOperations()
      Clears all shutdown operations without running them.
      static void runOperations()
      Runs the shutdown operations
      • Methods inherited from class java.lang.Object

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

      • DEFAULT_SHUTDOWN_OPERATION

        public static final java.lang.Runnable DEFAULT_SHUTDOWN_OPERATION
    • Constructor Detail

      • ShutdownOperations

        public ShutdownOperations()
    • Method Detail

      • runOperations

        public static void runOperations()
        Runs the shutdown operations
      • addOperation

        public static void addOperation​(java.lang.Runnable runnable)
        Adds a shutdown operation which will be run once for the next shutdown
        Parameters:
        runnable - The runnable operation
      • addOperation

        public static void addOperation​(java.lang.Runnable runnable,
                                        boolean preserveForNextShutdown)
        Adds a shutdown operation
        Parameters:
        runnable - The runnable operation
        preserveForNextShutdown - should preserve the operation for subsequent shutdowns, useful in tests
      • resetOperations

        public static void resetOperations()
        Clears all shutdown operations without running them. Also clears operations that are kept after running operations.