Module io.avaje.jex
Package io.avaje.jex

Interface AppLifecycle


public interface AppLifecycle
Defines the lifecycle configuration for an application.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static enum 
    Represents the possible states of the application server.
  • Method Summary

    Modifier and Type
    Method
    Description
    default boolean
    Indicates whether the application server is currently starting or has started.
    default boolean
    Indicates whether the application server has fully started.
    void
    onShutdown(Runnable onShutdown)
    Registers a runnable to be executed when the application server is shutting down.
    void
    onShutdown(Runnable onShutdown, int order)
    Registers a runnable to be executed when the application server is shutting down, with a specific order.
    void
    Registers a runnable as a shutdown hook with the JVM.
    Returns the current status of the application server.
    void
    Sets the current status of the application server.
  • Method Details

    • onShutdown

      void onShutdown(Runnable 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

      void onShutdown(Runnable onShutdown, int order)
      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

      void registerShutdownHook(Runnable onShutdown)
      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

      Returns the current status of the application server.
      Returns:
      The current status of the server.
    • status

      void status(AppLifecycle.Status newStatus)
      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.