You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2022/06/07 09:35:51 UTC

[sling-org-apache-sling-resourceresolver] branch master updated: SLING-11363: resource resolver: bloom filter incomplete when vanity path size limited (#71)

This is an automated email from the ASF dual-hosted git repository.

cziegeler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resourceresolver.git


The following commit(s) were added to refs/heads/master by this push:
     new 3da15b5  SLING-11363: resource resolver: bloom filter incomplete when vanity path size limited (#71)
3da15b5 is described below

commit 3da15b56db611a8d7ac9d095daef8a5121a4889f
Author: Julian Reschke <ju...@gmx.de>
AuthorDate: Tue Jun 7 11:35:47 2022 +0200

    SLING-11363: resource resolver: bloom filter incomplete when vanity path size limited (#71)
    
    * SLING-11363: resource resolver: bloom filter incomplete when vanity path size limited
    
    * SLING-11363: simplify code further
    
    * SLING-11363: simplify code further
---
 .../apache/sling/resourceresolver/impl/mapping/MapEntries.java   | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java b/src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java
index 0969718..7f9ffc7 100644
--- a/src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java
+++ b/src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java
@@ -71,7 +71,6 @@ import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.concurrent.locks.ReentrantLock;
-import java.util.function.Supplier;
 import java.util.stream.Stream;
 
 public class MapEntries implements
@@ -1253,15 +1252,15 @@ public class MapEntries implements
 
         long count = 0;
         long processStart = System.nanoTime();
-        Supplier<Boolean> isCacheComplete = () -> isAllVanityPathEntriesCached()
-                || vanityCounter.longValue() < this.factory.getMaxCachedVanityPathEntries();
 
-        while (i.hasNext() && isCacheComplete.get()) {
+        while (i.hasNext()) {
             count += 1;
             final Resource resource = i.next();
             final String resourcePath = resource.getPath();
             if (Stream.of(this.factory.getObservationPaths()).anyMatch(path -> path.matches(resourcePath))) {
-                loadVanityPath(resource, resolveMapsMap, targetPaths, isCacheComplete.get());
+                final boolean addToCache = isAllVanityPathEntriesCached()
+                        || vanityCounter.longValue() < this.factory.getMaxCachedVanityPathEntries();
+                loadVanityPath(resource, resolveMapsMap, targetPaths, addToCache);
             }
         }
         long processElapsed = System.nanoTime() - processStart;