use of fish.payara.microprofile.healthcheck.HealthCheckType.LIVENESS in project Payara by payara.
the class HealthCheckService method getCollectiveHealthChecks.
private Map<String, Set<HealthCheck>> getCollectiveHealthChecks(HealthCheckType type) {
final Map<String, Set<HealthCheck>> healthChecks;
if (type == READINESS) {
healthChecks = readiness;
} else if (type == LIVENESS) {
healthChecks = liveness;
} else if (type == STARTUP) {
healthChecks = startup;
} else {
// Make sure we do a deep-copy first, otherwise the first map the foreach consumer gets used on will be a
// shallow copy: the two maps will essentially be the same map (changes to one affecting the other)
healthChecks = readiness.entrySet().stream().collect(Collectors.toMap(entry -> entry.getKey(), entry -> new HashSet(entry.getValue())));
BiConsumer<? super String, ? super Set<HealthCheck>> mergeHealthCheckMap = (key, value) -> healthChecks.merge(key, value, (oldValue, newValue) -> {
oldValue.addAll(newValue);
return oldValue;
});
liveness.forEach(mergeHealthCheckMap);
startup.forEach(mergeHealthCheckMap);
}
return healthChecks;
}
Aggregations