public static interface Lifecycle.LifecycleRegistry
Component may register activities to be executed at startup or shutdown. These activities may be executed
onStart(int, Runnable) and onShutdown(int, Runnable). With this
approach, the lifecycle action is considered completed when the method returns.#onStart(int, LifecycleHandler) and
#onShutdown(int, LifecycleHandler). This approach expects handler methods to return a
CompletableFuture that completes when the lifecycle action is completed| Modifier and Type | Method and Description |
|---|---|
void |
onShutdown(int phase,
Lifecycle.LifecycleHandler action)
Registers the given
action to run during the given phase during shutdown. |
default void |
onShutdown(int phase,
Runnable action)
Registers the given
action to run during the given phase during shutdown. |
void |
onStart(int phase,
Lifecycle.LifecycleHandler action)
Registers the given
action to run during the given phase during startup. |
default void |
onStart(int phase,
Runnable action)
Registers the given
action to run during the given phase during startup. |
default void onStart(int phase,
@Nonnull
Runnable action)
action to run during the given phase during startup. Lower phases
are executed before higher phases.phase - The phase in which to execute this actionaction - The action to performPhasedefault void onShutdown(int phase,
@Nonnull
Runnable action)
action to run during the given phase during shutdown. Higher phases are executed before lower phases.phase - The phase in which to execute this actionaction - The action to performPhasevoid onStart(int phase,
@Nonnull
Lifecycle.LifecycleHandler action)
action to run during the given phase during startup. Lower phases
are executed before higher phases.
Various handlers for the same phase may be executed concurrently, but handlers for subsequent phases will
only be invoked when the returned CompletableFuture completes (normally or exceptionally).
phase - The phase in which to execute this actionaction - The action to performPhasevoid onShutdown(int phase,
@Nonnull
Lifecycle.LifecycleHandler action)
action to run during the given phase during shutdown. Higher
phases are executed before lower phases.
Various handlers for the same phase may be executed concurrently, but handlers for subsequent phases will
only be invoked when the returned CompletableFuture completes (normally or exceptionally).
phase - The phase in which to execute this actionaction - The action to performPhaseCopyright © 2010–2023. All rights reserved.