Package: org.grails.core.lifecycle

## [Java] Class ShutdownOperations

- org.grails.core.lifecycle.ShutdownOperations

- Operations that should be executed on shutdown.

  Authors:
    Graeme Rocher
  Since:
    2.0

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `static java.lang.Runnable` | `DEFAULT_SHUTDOWN_OPERATION` |

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and 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

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class java.lang.Object` | `java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()`

- - ### Field Detail

    - #### public static final java.lang.Runnable DEFAULT_SHUTDOWN_OPERATION

  - ### Method Detail

    - #### 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

    - #### 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

    - #### public static void resetOperations()

      Clears all shutdown operations without running them. Also clears operations that are kept after running operations.

    - #### public static void runOperations()

      Runs the shutdown operations