Package io.deephaven.util.process
Interface ShutdownManager
- All Known Implementing Classes:
ShutdownManagerImpl
public interface ShutdownManager
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic enum
Categories that define ordering "groups" for serial execution during task invocation.static interface
A single unit of work for shutdown. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a shutdown hook to the runtime that will invoke all registered shutdown tasks, if they haven't previously been invoked.void
deregisterTask
(@NotNull ShutdownManager.OrderingCategory orderingCategory, @NotNull ShutdownManager.Task task) Remove the most recent registration of task with orderingCategory.boolean
Invoke all registered shutdown tasks, if they haven't previously been invoked.void
registerTask
(@NotNull ShutdownManager.OrderingCategory orderingCategory, @NotNull ShutdownManager.Task task) Register task for shutdown invocation along with other tasks belonging to orderingCategory.void
reset()
Clear all shutdown tasks and reset internal state.boolean
-
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
-