in src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java [720:777]
private List<MapEntry> getMapEntryList(String vanityPath) {
List<MapEntry> mapEntries = null;
boolean initFinished = vanityPathsProcessed.get();
boolean probablyPresent = false;
if (initFinished) {
// total number of lookups after init (and when cache not complete)
long current = this.vanityPathLookups.incrementAndGet();
if (current >= Long.MAX_VALUE - 100000) {
// reset counters when we get close the limit
this.vanityPathLookups.set(1);
this.vanityPathBloomNegative.set(0);
this.vanityPathBloomFalsePositive.set(0);
log.info("Vanity Path metrics reset to 0");
}
// init is done - check the bloom filter
probablyPresent = BloomFilterUtils.probablyContains(vanityBloomFilter, vanityPath);
log.trace("bloom filter lookup for {} -> {}", vanityPath, probablyPresent);
if (!probablyPresent) {
// filtered by Bloom filter
this.vanityPathBloomNegative.incrementAndGet();
}
}
if (!initFinished || probablyPresent) {
mapEntries = this.resolveMapsMap.get(vanityPath);
if (mapEntries == null) {
if (!initFinished && temporaryResolveMapsMap != null) {
mapEntries = temporaryResolveMapsMap.get(vanityPath);
if (mapEntries != null) {
temporaryResolveMapsMapHits.incrementAndGet();
log.trace("getMapEntryList: using temp map entries for {} -> {}", vanityPath, mapEntries);
} else {
temporaryResolveMapsMapMisses.incrementAndGet();
}
}
if (mapEntries == null) {
Map<String, List<MapEntry>> mapEntry = getVanityPaths(vanityPath);
mapEntries = mapEntry.get(vanityPath);
if (!initFinished && temporaryResolveMapsMap != null) {
log.trace("getMapEntryList: caching map entries for {} -> {}", vanityPath, mapEntries);
temporaryResolveMapsMap.put(vanityPath, mapEntries == null ? NO_MAP_ENTRIES : mapEntries);
}
}
}
if (mapEntries == null && probablyPresent) {
// Bloom filter had a false positive
this.vanityPathBloomFalsePositive.incrementAndGet();
}
}
return mapEntries == NO_MAP_ENTRIES ? null : mapEntries;
}