Class ApplicationRunStatusProvider

java.lang.Object
com.github.jpmsilva.jsystemd.spring.ApplicationRunStatusProvider
All Implemented Interfaces:
StatusProvider

public class ApplicationRunStatusProvider extends Object implements StatusProvider
Implementation of StatusProvider that provides information regarding the Spring Boot application startup sequence state. Its state is meant to be updated by a SpringApplicationRunListener, as the one of the Spring Boot starter does.
Author:
Joao Silva
See Also:
  • Constructor Details

    • ApplicationRunStatusProvider

      public ApplicationRunStatusProvider()
      Creates a new instance, which sends the status to systemd on every change of state.

      The created instance is not registered as a status provider of Systemd.instance(): that is up to the caller.

  • Method Details

    • status

      public String status()
      Description copied from interface: StatusProvider
      Exposes status information to send to systemd.
      Specified by:
      status in interface StatusProvider
      Returns:
      the string message to add to the service status
    • state

      Updates the current application startup sequence state of the application, sending the update to systemd as well.
      Parameters:
      state - the current application startup sequence state
    • state

      public void state(ApplicationRunStatusProvider.ApplicationState state, @Nullable Duration timeTaken)
      Updates the current application startup sequence state of the application, sending the update to systemd as well.
      Parameters:
      state - the current application startup sequence state
      timeTaken - the time taken for the application to reach this state, if known