Author: asanso Date: Tue Jul 21 14:55:01 2015 New Revision: 1692140 URL: http://svn.apache.org/r1692140 Log: SLING-4891 - Improve MapEntries to cache searched vanity paths
Modified: sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java Modified: sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java?rev=1692140&r1=1692139&r2=1692140&view=diff ============================================================================== --- sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java (original) +++ sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java Tue Jul 21 14:55:01 2015 @@ -452,7 +452,7 @@ public class MapEntries implements Event private void doAddVanity(String path) { Resource resource = resolver.getResource(path); - if (maxCachedVanityPathEntries == -1 || vanityCounter.longValue() < maxCachedVanityPathEntries) { + if (isAllVanityPathEntriesCached() || vanityCounter.longValue() < maxCachedVanityPathEntries) { // fill up the cache and the bloom filter loadVanityPath(resource, resolveMapsMap, vanityTargets, true, true); } else { @@ -1122,9 +1122,9 @@ public class MapEntries implements Event final String queryString = "SELECT sling:vanityPath, sling:redirect, sling:redirectStatus FROM sling:VanityPath WHERE sling:vanityPath IS NOT NULL"; final Iterator<Resource> i = resolver.findResources(queryString, "sql"); - while (i.hasNext() && (createVanityBloomFilter ||maxCachedVanityPathEntries == -1 || vanityCounter.longValue() < maxCachedVanityPathEntries)) { + while (i.hasNext() && (createVanityBloomFilter || isAllVanityPathEntriesCached() || vanityCounter.longValue() < maxCachedVanityPathEntries)) { final Resource resource = i.next(); - if (maxCachedVanityPathEntries == -1 || vanityCounter.longValue() < maxCachedVanityPathEntries) { + if (isAllVanityPathEntriesCached() || vanityCounter.longValue() < maxCachedVanityPathEntries) { // fill up the cache and the bloom filter loadVanityPath(resource, resolveMapsMap, targetPaths, true, createVanityBloomFilter);