This is an automated email from the ASF dual-hosted git repository.
reschke pushed a commit to branch SLING-12648
in repository
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resourceresolver.git
The following commit(s) were added to refs/heads/SLING-12648 by this push:
new 9cfc1fb SLING-12648: MapEntries: factor out vanity path handling -
pass 'initializing' lock down
9cfc1fb is described below
commit 9cfc1fb21191d3c2c3bc2006a7d54bb1b0eae3a2
Author: Julian Reschke <[email protected]>
AuthorDate: Fri Feb 14 17:06:32 2025 +0100
SLING-12648: MapEntries: factor out vanity path handling - pass
'initializing' lock down
---
.../sling/resourceresolver/impl/mapping/MapEntries.java | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 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 5122ec9..5c0c297 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
@@ -170,7 +170,7 @@ public class MapEntries implements
this.registration = registerResourceChangeListener(bundleContext);
- this.vph = new VanityPathHandler(this.factory, this.resolveMapsMap);
+ this.vph = new VanityPathHandler(this.factory, this.resolveMapsMap,
this.initializing);
this.vph.initializeVanityPaths();
this.metrics = metrics;
@@ -390,7 +390,7 @@ public class MapEntries implements
}
if (sendEvent) {
- MapEntries.this.sendChangeEvent();
+ this.sendChangeEvent();
}
}
@@ -1179,9 +1179,12 @@ public class MapEntries implements
// Temporary cache for use while doing async vanity path query
private Map<String, List<MapEntry>> temporaryResolveMapsMap;
- public VanityPathHandler(MapConfigurationProvider factory, Map<String,
List<MapEntry>> resolveMapsMap) {
+ private final ReentrantLock initializing;
+
+ public VanityPathHandler(MapConfigurationProvider factory, Map<String,
List<MapEntry>> resolveMapsMap, ReentrantLock initializing) {
this.factory = factory;
this.resolveMapsMap = resolveMapsMap;
+ this.initializing = initializing;
}
public boolean isReady() {
@@ -1200,7 +1203,7 @@ public class MapEntries implements
* @throws IOException in case of problems
*/
protected void initializeVanityPaths() throws IOException {
- MapEntries.this.initializing.lock();
+ this.initializing.lock();
try {
if (this.factory.isVanityPathEnabled()) {
vanityPathsProcessed.set(false);
@@ -1216,16 +1219,16 @@ public class MapEntries implements
}
}
} finally {
- MapEntries.this.initializing.unlock();
+ this.initializing.unlock();
}
}
private boolean removeVanityPath(final String path) {
- MapEntries.this.initializing.lock();
+ this.initializing.lock();
try {
return doRemoveVanity(path);
} finally {
- MapEntries.this.initializing.unlock();
+ this.initializing.unlock();
}
}