}
Result checkForRecursion(ServiceReference hcReference, Set<String> alreadyBannedTags) {
HealthCheckMetadata thisCheckMetadata = new HealthCheckMetadata(hcReference);
Set<String> bannedTagsForThisCompositeCheck = new HashSet<String>();
bannedTagsForThisCompositeCheck.addAll(alreadyBannedTags);
bannedTagsForThisCompositeCheck.addAll(thisCheckMetadata.getTags());
String[] tagsForIncludedChecksArr = PropertiesUtil.toStringArray(hcReference.getProperty(PROP_FILTER_TAGS), new String[0]);
Set<String> tagsForIncludedChecks = new HashSet<String>(Arrays.asList(tagsForIncludedChecksArr));
log.debug("HC {} has banned tags {}", thisCheckMetadata.getName(), bannedTagsForThisCompositeCheck);
log.debug("tagsForIncludedChecks {}", tagsForIncludedChecks);
// is this HC ok?
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 + ")");
}