indexData() causes individual queries which is slow when there are a lot of rules.
e.g. try to find what queries are individual and bulk fetch them in advance
private void indexData() { |
this.ruleCheckIndex = new HashMap<RuleCheck, Set<RuleDefinition>>(); |
|
// loop through rules and get stems to bulk select |
Set<String> stemNames = new HashSet<String>(); |
Set<String> stemIds = new HashSet<String>(); |
for (RuleDefinition ruleDefinition : GrouperUtil.nonNull(this.ruleDefinitions)) { |
String stemName = ruleDefinition.getCheck().getCheckOwnerName();
|
String stemId = ruleDefinition.getCheck().getCheckOwnerId();
|
if (!StringUtils.isBlank(stemName) && stemName.contains(":")) { |
stemNames.add(stemName);
|
}
|
if (!StringUtils.isBlank(stemId)) { |
stemIds.add(stemId);
|
}
|
}
|
// look up stems in batches by names then by ids to populate the cache |
|