in aws-xray-recorder-sdk-core/src/main/java/com/amazonaws/xray/strategy/sampling/manifest/CentralizedManifest.java [91:121]
public void putRules(List<SamplingRule> inputs, Instant now) {
// Set to true if we see a new or deleted rule or a change in the priority of an existing rule.
boolean invalidate = false;
Map<String, CentralizedRule> rules = this.rules;
List<String> inputNames = new ArrayList<>(inputs.size());
for (SamplingRule i : inputs) {
if (i.getRuleName().equals(CentralizedRule.DEFAULT_RULE_NAME)) {
putDefaultRule(i);
} else {
inputNames.add(i.getRuleName());
invalidate = putCustomRule(rules, i);
}
}
// Check if any rule was removed
if (!invalidate) {
for (CentralizedRule rule : rules.values()) {
if (!inputNames.contains(rule.getName())) {
invalidate = true;
break;
}
}
}
if (invalidate) {
this.rules = rebuild(rules, inputs);
}
this.refreshedAt = now;
}