public interface ShutdownHook
spring.lifecycle.timeout.per.shutdown.phase
system property). After that grace period is over, component will
be asked to shutdown immediately.ShutdownHookStatus
Modifier and Type | Method and Description |
---|---|
ShutdownHookStatus |
getStatus() |
default void |
shutdownNow()
Indicates that component should shutdown immediately as grace period for shutting down is over.
|
void |
startShutdown(Duration timeout)
Indicates that component should start shutdown process such that it stops performing new tasks, but leave currently
running tasks uninterrupted until asked to shutdown immediately.
|
@Nonnull ShutdownHookStatus getStatus()
status
of component to help decide if it is safe to terminate or not. This
method is polled repeatedly after startShutdown(Duration)
method is called. Once this method returns
IDLE
status, this component is assumed safe for shutdown.default void shutdownNow()
void startShutdown(@Nonnull Duration timeout)
polled
to check
status
. This method will be called once per component during application shutdown,
provided `server.shutdown`
system property is set as 'graceful'
. This method will never be called
if `server.shutdown`
is set as 'immediate'
.timeout
- this is the time that can be taken to wait for shutdown to be complete after initiation. It is
optional to use this timeout and just initiate the shutdown without waiting for termination, in
which case, polling will be done using getStatus()
until ShutdownHookStatus.IDLE
.Copyright © 2024 Atlassian. All rights reserved.