Class HealthCheckService

  • All Implemented Interfaces:
    fish.payara.monitoring.collect.MonitoringDataSource, fish.payara.monitoring.collect.MonitoringWatchSource, EventListener, ConfigListener

    @Service(name="healthcheck-service")
    @RunLevel(10)
    public class HealthCheckService
    extends Object
    implements EventListener, ConfigListener, fish.payara.monitoring.collect.MonitoringDataSource, fish.payara.monitoring.collect.MonitoringWatchSource
    Service that handles the registration, execution, and response of MicroProfile HealthChecks.
    Author:
    Andrew Pielage
    • Constructor Detail

      • HealthCheckService

        public HealthCheckService()
    • Method Detail

      • postConstruct

        @PostConstruct
        public void postConstruct()
      • collect

        public void collect​(fish.payara.monitoring.collect.MonitoringDataCollector collector)
        Specified by:
        collect in interface fish.payara.monitoring.collect.MonitoringDataSource
      • collect

        public void collect​(fish.payara.monitoring.collect.MonitoringWatchCollector collector)
        Specified by:
        collect in interface fish.payara.monitoring.collect.MonitoringWatchSource
      • isEnabled

        public boolean isEnabled()
      • isSecurityEnabled

        public boolean isSecurityEnabled()
      • registerHealthCheck

        public void registerHealthCheck​(String healthCheckName,
                                        org.eclipse.microprofile.health.HealthCheck healthCheck,
                                        HealthCheckType type)
        Register a HealthCheck to the Set of HealthChecks to execute when performHealthChecks is called.
        Parameters:
        healthCheckName - The name of the HealthCheck
        healthCheck - The HealthCheck to register
      • unregisterHealthCheck

        public void unregisterHealthCheck​(String appName)
      • registerClassLoader

        public void registerClassLoader​(String appName,
                                        ClassLoader classloader)
        Register a ClassLoader for an application.
        Parameters:
        appName - The name of the application being deployed
        classloader -
      • performHealthChecks

        public void performHealthChecks​(jakarta.servlet.http.HttpServletResponse response,
                                        HealthCheckType type,
                                        String enablePrettyPrint)
                                 throws IOException
        Execute the call method of every registered HealthCheck and generate the response.
        Parameters:
        response - The response to return
        type - the type of health check
        Throws:
        IOException - If there's an issue writing the response
      • changed

        public UnprocessedChangeEvents changed​(PropertyChangeEvent[] events)
        Description copied from interface: ConfigListener
        Notification that @Configured objects that were injected have changed
        Specified by:
        changed in interface ConfigListener
        Parameters:
        events - list of changes
        Returns:
        the list of unprocessed events (requiring a restart) or null if all reconfiguration was processed successfully