in src/main/java/org/apache/sling/resourceresolver/impl/mapping/VanityPathHandler.java [278:328]
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.vanityPathBloomNegatives.set(0);
this.vanityPathBloomFalsePositives.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.vanityPathBloomNegatives.incrementAndGet();
}
}
if (!initFinished || probablyPresent) {
// check the cache
mapEntries = this.resolveMapsMap.get(vanityPath);
if (mapEntries == null) {
// try temporary map first
if (!initFinished && temporaryResolveMapsMap != null) {
mapEntries = getMapEntriesFromTemporaryMap(vanityPath);
}
// still no entries? Try regular lookup, then update the temporary map
if (mapEntries == null) {
mapEntries = getMapEntriesFromRepository(vanityPath, initFinished);
}
}
if (mapEntries == null && probablyPresent) {
// Bloom filter had a false positive
this.vanityPathBloomFalsePositives.incrementAndGet();
}
}
return mapEntries == noMapEntries ? null : mapEntries;
}