Search in sources :

Example 1 with PayaraHealthCheck

use of fish.payara.microprofile.healthcheck.checks.PayaraHealthCheck in project Payara by payara.

the class HealthCheckService method event.

@Override
public void event(Event<?> event) {
    // Remove healthchecks when the app is undeployed.
    Deployment.APPLICATION_UNLOADED.onMatch(event, appInfo -> unregisterHealthCheck(appInfo.getName()));
    // Keep track of all deployed applications.
    Deployment.APPLICATION_STARTED.onMatch(event, appInfo -> applicationsLoaded.add(appInfo.getName()));
    PayaraHealthCheckServiceEvents.HEALTHCHECK_SERVICE_CHECKER_ADD_TO_MICROPROFILE_HEALTH.onMatch(event, healthChecker -> registerHealthCheck(healthChecker.getName(), new PayaraHealthCheck(healthChecker.getName(), healthChecker.getCheck()), READINESS));
    PayaraHealthCheckServiceEvents.HEALTHCHECK_SERVICE_CHECKER_REMOVE_FROM_MICROPROFILE_HEALTH.onMatch(event, healthChecker -> unregisterHealthCheck(healthChecker.getName()));
    if (event.is(PayaraHealthCheckServiceEvents.HEALTHCHECK_SERVICE_DISABLED)) {
        for (Checker checker : getHealthCheckerList()) {
            if (Boolean.valueOf(checker.getAddToMicroProfileHealth())) {
                unregisterHealthCheck(checker.getName());
            }
        }
    }
}
Also used : PayaraHealthCheck(fish.payara.microprofile.healthcheck.checks.PayaraHealthCheck) Checker(fish.payara.nucleus.healthcheck.configuration.Checker)

Aggregations

PayaraHealthCheck (fish.payara.microprofile.healthcheck.checks.PayaraHealthCheck)1 Checker (fish.payara.nucleus.healthcheck.configuration.Checker)1