Interface Lifecycle.LifecycleRegistry

Enclosing interface:
Lifecycle

public static interface Lifecycle.LifecycleRegistry
Interface towards the registry that holds all lifecycle handlers for components.

Component may register activities to be executed at startup or shutdown. These activities may be executed

  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    onShutdown(int phase, Runnable action)
    Registers the given action to run during the given phase during shutdown.
    void
    Registers the given action to run during the given phase during shutdown.
    default void
    onStart(int phase, Runnable action)
    Registers the given action to run during the given phase during startup.
    void
    onStart(int phase, Lifecycle.LifecycleHandler action)
    Registers the given action to run during the given phase during startup.
  • Method Details

    • onStart

      default void onStart(int phase, @Nonnull Runnable action)
      Registers the given action to run during the given phase during startup. Lower phases are executed before higher phases.
      Parameters:
      phase - The phase in which to execute this action
      action - The action to perform
      See Also:
    • onShutdown

      default void onShutdown(int phase, @Nonnull Runnable action)
      Registers the given action to run during the given phase during shutdown. Higher phases are executed before lower phases.
      Parameters:
      phase - The phase in which to execute this action
      action - The action to perform
      See Also:
    • onStart

      void onStart(int phase, @Nonnull Lifecycle.LifecycleHandler action)
      Registers the given 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).

      Parameters:
      phase - The phase in which to execute this action
      action - The action to perform
      See Also:
    • onShutdown

      void onShutdown(int phase, @Nonnull Lifecycle.LifecycleHandler action)
      Registers the given 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).

      Parameters:
      phase - The phase in which to execute this action
      action - The action to perform
      See Also: