Package: org.grails.core.lifecycle

## [Java] Class ShutdownOperations

- org.grails.core.lifecycle.ShutdownOperations

-     public class ShutdownOperations
      extends java.lang.Object

  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` |
    `private static org.apache.commons.logging.Log` | `LOG` |
    `private static java.util.Collection<java.lang.Runnable>` | `preservedShutdownOperations` |
    `private static java.util.Collection<java.lang.Runnable>` | `shutdownOperations` |

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public static void` | `addOperation(java.lang.Runnable runnable)` Adds a shutdown operation which will be run once for the next shutdown
    `` | `public static void` | `addOperation(java.lang.Runnable runnable, boolean preserveForNextShutdown)` Adds a shutdown operation
    `` | `public static void` | `resetOperations()` Clears all shutdown operations without running them.
    `` | `public 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), java.lang.Object#wait(long, int), 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

    - #### private static final org.apache.commons.logging.Log LOG

    - #### private static final java.util.Collection<java.lang.Runnable> preservedShutdownOperations

    - #### private static final java.util.Collection<java.lang.Runnable> shutdownOperations

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