You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by re...@apache.org on 2025/03/07 13:24:42 UTC

(sling-org-apache-sling-resourceresolver) branch SLING-12701 updated: SLING-12701: MapEntries - move alias handling into inner class - add updateConf callback

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

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


The following commit(s) were added to refs/heads/SLING-12701 by this push:
     new e7953751 SLING-12701: MapEntries - move alias handling into inner class - add updateConf callback
e7953751 is described below

commit e7953751356b598c92fcfeda38380fb07044edb0
Author: Julian Reschke <re...@apache.org>
AuthorDate: Fri Mar 7 14:24:31 2025 +0100

    SLING-12701: MapEntries - move alias handling into inner class - add updateConf callback
---
 .../apache/sling/resourceresolver/impl/mapping/MapEntries.java | 10 ++++++----
 1 file changed, 6 insertions(+), 4 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 2987e91d..5590303d 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
@@ -140,7 +140,7 @@ public class MapEntries implements
         this.mapMaps = Collections.<MapEntry> emptyList();
         this.stringInterpolationProvider = stringInterpolationProvider;
 
-        this.ah = new AliasHandler(this.factory, this.initializing);
+        this.ah = new AliasHandler(this.factory, this.initializing, this::doUpdateConfiguration);
 
         this.useOptimizeAliasResolution = ah.initializeAliases();
 
@@ -768,6 +768,7 @@ public class MapEntries implements
     // keep track of some defunct aliases for diagnostics (thus size-limited)
     private static final int MAX_REPORT_DEFUNCT_ALIASES = 50;
 
+    private Runnable doUpdateConfiguration;
    /**
     * The key of the map is the parent path, while the value is a map with the the resource name as key and the actual aliases as values)
     */
@@ -777,10 +778,12 @@ public class MapEntries implements
     final AtomicLong detectedConflictingAliases;
     final AtomicLong detectedInvalidAliases;
 
-    public AliasHandler(MapConfigurationProvider factory, ReentrantLock initializing) {
+    public AliasHandler(MapConfigurationProvider factory, ReentrantLock initializing,
+                        Runnable doUpdateConfiguration) {
         this.factory = factory;
         this.initializing = initializing;
         this.aliasMapsMap = new ConcurrentHashMap<>();
+        this.doUpdateConfiguration = doUpdateConfiguration;
 
         this.aliasResourcesOnStartup = new AtomicLong(0);
         this.detectedConflictingAliases = new AtomicLong(0);
@@ -837,8 +840,7 @@ public class MapEntries implements
                 }
             }
 
-            doUpdateConfiguration();
-
+            doUpdateConfiguration.run();
             sendChangeEvent();
 
             return isOptimizeAliasResolutionEnabled;