public interface AppLifecycle
Defines the lifecycle configuration for an application.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumRepresents the possible states of the application server. -
Method Summary
Modifier and TypeMethodDescriptiondefault booleanisAlive()Indicates whether the application server is currently starting or has started.default booleanisReady()Indicates whether the application server has fully started.voidonShutdown(Runnable onShutdown) Registers a runnable to be executed when the application server is shutting down.voidonShutdown(Runnable onShutdown, int order) Registers a runnable to be executed when the application server is shutting down, with a specific order.voidregisterShutdownHook(Runnable onShutdown) Registers a runnable as a shutdown hook with the JVM.status()Returns the current status of the application server.voidstatus(AppLifecycle.Status newStatus) Sets the current status of the application server.
-
Method Details
-
onShutdown
Registers a runnable to be executed when the application server is shutting down.This runnable will be executed after all active requests have been processed.
- Parameters:
onShutdown- The runnable to execute on shutdown.
-
onShutdown
Registers a runnable to be executed when the application server is shutting down, with a specific order.Runnables with lower order values will be executed first.
This runnable will be executed after all active requests have been processed.
- Parameters:
onShutdown- The runnable to execute on shutdown.order- The order in which to execute the runnable.
-
registerShutdownHook
Registers a runnable as a shutdown hook with the JVM.This runnable will be executed when the JVM is shutting down, regardless of the application server's state.
- Parameters:
onShutdown- The runnable to register as a shutdown hook.
-
status
AppLifecycle.Status status()Returns the current status of the application server.- Returns:
- The current status of the server.
-
status
Sets the current status of the application server.- Parameters:
newStatus- The new status to set.
-
isAlive
default boolean isAlive()Indicates whether the application server is currently starting or has started.- Returns:
- true if the server is starting or started, false otherwise.
-
isReady
default boolean isReady()Indicates whether the application server has fully started.- Returns:
- true if the server has started, false otherwise.
-