Package com.atlassian.bitbucket.shutdown
Interface ShutdownHook
public interface ShutdownHook
Interface to be implemented by components who need to be informed about shutdown as soon as it is initiated. These
 components will be given the opportunity to start shutdown, to allow them to shutdown
 gracefully before the application terminates them. Components are allowed to complete shutdown for the maximum time
 allowed per shutdown lifecycle phase which is defined at system level (configured with
 
spring.lifecycle.timeout.per.shutdown.phase system property). After that grace period is over, component will
 be asked to shutdown immediately.- Since:
- 7.8
- See Also:
- 
Method SummaryModifier and TypeMethodDescriptiondefault voidIndicates that component should shutdown immediately as grace period for shutting down is over.voidstartShutdown(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.
- 
Method Details- 
getStatus- Returns:
- statusof 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- IDLEstatus, this component is assumed safe for shutdown.
 
- 
shutdownNowdefault void shutdownNow()Indicates that component should shutdown immediately as grace period for shutting down is over. Implementing this method is optional in which case component can be forcefully shutdown in it's usual lifecycle phase or by termination of JVM process.
- 
startShutdownIndicates that component should start shutdown process such that it stops performing new tasks, but leave currently running tasks uninterrupted until asked to shutdown immediately. After starting shutdown process, it can be waited for completion, otherwise, component will be repeatedlypolledto checkstatus. 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'.- Parameters:
- 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.
 
 
-