Class ApplicationShutdownHook
java.lang.Object
io.sbk.utils.ApplicationShutdownHook
Registers a bounded JVM shutdown hook for an SBK application.
The actual application cleanup runs on a separate daemon thread. The JVM
hook waits for it only for a bounded interval, ensuring that a blocked
storage driver, SSH operation, logger, or network server cannot prevent the
process from terminating after SIGINT or SIGTERM.
-
Method Summary
-
Method Details
-
register
Registers a shutdown hook for an application benchmark.- Parameters:
applicationName- application name used in lifecycle messagescleanup- cleanup operation, normallybenchmark.stop()- Returns:
- the registered hook, which can be removed after normal completion
-
remove
Removes a previously registered hook after normal application shutdown.If JVM shutdown has already started, hook removal is no longer legal; this method deliberately ignores that race because the hook is already performing the requested cleanup.
- Parameters:
hook- hook returned byregister(String, Runnable)
-