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 completedModifier 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 phase
s
are executed before higher phase
s.phase
- The phase in which to execute this actionaction
- The action to performPhase
default void onShutdown(int phase, @Nonnull Runnable action)
action
to run during the given phase
during shutdown. Higher phase
s are executed before lower phase
s.phase
- The phase in which to execute this actionaction
- The action to performPhase
void onStart(int phase, @Nonnull Lifecycle.LifecycleHandler action)
action
to run during the given phase
during startup. Lower phase
s
are executed before higher phase
s.
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 performPhase
void onShutdown(int phase, @Nonnull Lifecycle.LifecycleHandler action)
action
to run during the given phase
during shutdown. Higher
phase
s are executed before lower phase
s.
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 performPhase
Copyright © 2010–2024. All rights reserved.