Interface ShutdownManager

All Known Implementing Classes:
ShutdownManagerImpl

public interface ShutdownManager
  • Method Details

    • addShutdownHookToRuntime

      void addShutdownHookToRuntime()
      Add a shutdown hook to the runtime that will invoke all registered shutdown tasks, if they haven't previously been invoked.
    • registerTask

      void registerTask(@NotNull @NotNull ShutdownManager.OrderingCategory orderingCategory, @NotNull @NotNull ShutdownManager.Task task)
      Register task for shutdown invocation along with other tasks belonging to orderingCategory. Registration concurrent with invocation (that is, shutdown in progress) is not guaranteed to be effective.
      Parameters:
      orderingCategory -
      task -
    • deregisterTask

      void deregisterTask(@NotNull @NotNull ShutdownManager.OrderingCategory orderingCategory, @NotNull @NotNull ShutdownManager.Task task)
      Remove the most recent registration of task with orderingCategory. De-registration concurrent with invocation (that is, shutdown in progress) is not guaranteed to be effective.
      Parameters:
      orderingCategory -
      task -
    • reset

      void reset()
      Clear all shutdown tasks and reset internal state. Useful for unit tests, not safe for production use cases.
    • tasksInvoked

      boolean tasksInvoked()
      Returns:
      True if shutdown tasks have been invoked (meaning shutdown is in progress).
    • maybeInvokeTasks

      boolean maybeInvokeTasks()
      Invoke all registered shutdown tasks, if they haven't previously been invoked.
      Returns:
      True if shutdown task invocation was performed by this call