Set<String> intersection = new HashSet<String>();
intersection.addAll(bannedTagsForThisCompositeCheck);
intersection.retainAll(tagsForIncludedChecks);
if (!intersection.isEmpty()) {
return new Result(Status.HEALTH_CHECK_ERROR,
"INVALID CONFIGURATION: Cycle detected in composite health check hierarchy. Health check '" + thisCheckMetadata.getName()
+ "' (" + hcReference.getProperty(Constants.SERVICE_PID) + ") must not have tag(s) " + intersection
+ " as a composite check in the hierarchy is itself already tagged alike (tags assigned to composite checks: "
+ bannedTagsForThisCompositeCheck + ")");
}
// check each sub composite check
ServiceReference[] hcRefsOfCompositeCheck = healthCheckFilter.getTaggedHealthCheckServiceReferences(tagsForIncludedChecksArr);
for (ServiceReference hcRefOfCompositeCheck : hcRefsOfCompositeCheck) {
if (CompositeHealthCheck.class.getName().equals(hcRefOfCompositeCheck.getProperty(ComponentConstants.COMPONENT_NAME))) {
log.debug("Checking sub composite HC {}, {}", hcRefOfCompositeCheck, hcRefOfCompositeCheck.getProperty(ComponentConstants.COMPONENT_NAME));
Result result = checkForRecursion(hcRefOfCompositeCheck, bannedTagsForThisCompositeCheck);
if (result != null) {
// found recursion
return result;
}
}