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/08/26 09:28:04 UTC
(sling-org-apache-sling-resourceresolver) branch SLING-12912 created (now 7b6b1ecc)
This is an automated email from the ASF dual-hosted git repository.
reschke pushed a change to branch SLING-12912
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resourceresolver.git
at 7b6b1ecc SLING-12912: alias handling: wire alias bg cache init to OSGi
This branch includes the following new commits:
new 7b6b1ecc SLING-12912: alias handling: wire alias bg cache init to OSGi
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(sling-org-apache-sling-resourceresolver) 01/01: SLING-12912: alias handling: wire alias bg cache init to OSGi
Posted by re...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
reschke pushed a commit to branch SLING-12912
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resourceresolver.git
commit 7b6b1ecc0eba49e10c5d198b62717e5532f9c377
Author: Julian Reschke <re...@apache.org>
AuthorDate: Tue Aug 26 10:27:49 2025 +0100
SLING-12912: alias handling: wire alias bg cache init to OSGi
---
.../impl/CommonResourceResolverFactoryImpl.java | 11 +++++------
.../impl/ResourceResolverFactoryActivator.java | 4 ++++
.../resourceresolver/impl/ResourceResolverFactoryConfig.java | 9 +++++++--
.../resourceresolver/impl/MockedResourceResolverImplTest.java | 5 +++++
4 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/src/main/java/org/apache/sling/resourceresolver/impl/CommonResourceResolverFactoryImpl.java b/src/main/java/org/apache/sling/resourceresolver/impl/CommonResourceResolverFactoryImpl.java
index 3428e8c6..1ba90732 100644
--- a/src/main/java/org/apache/sling/resourceresolver/impl/CommonResourceResolverFactoryImpl.java
+++ b/src/main/java/org/apache/sling/resourceresolver/impl/CommonResourceResolverFactoryImpl.java
@@ -397,12 +397,6 @@ public class CommonResourceResolverFactoryImpl implements MapConfigurationProvid
return this.activator.getVanityPathConfigurer().isVanityPathCacheInitInBackground();
}
- @Override
- public boolean isAliasCacheInitInBackground() {
- // wiring to config will be added later
- return false;
- }
-
/**
* get's the ServiceTracker of the ResourceAccessSecurity service
*/
@@ -445,6 +439,11 @@ public class CommonResourceResolverFactoryImpl implements MapConfigurationProvid
return this.activator.isOptimizeAliasResolutionEnabled();
}
+ @Override
+ public boolean isAliasCacheInitInBackground() {
+ return this.activator.isAliasCacheInitInBackground();
+ }
+
@Override
public boolean hasVanityPathPrecedence() {
return this.activator.getVanityPathConfigurer().hasVanityPathPrecedence();
diff --git a/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryActivator.java b/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryActivator.java
index 3b285591..f8bdaee4 100644
--- a/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryActivator.java
+++ b/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryActivator.java
@@ -192,6 +192,10 @@ public class ResourceResolverFactoryActivator {
return this.config.resource_resolver_optimize_alias_resolution();
}
+ public boolean isAliasCacheInitInBackground() {
+ return this.config.resource_resolver_alias_cache_in_background();
+ }
+
public Set<String> getAllowedAliasLocations() {
return this.allowedAliasLocations;
}
diff --git a/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryConfig.java b/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryConfig.java
index 5b5b31b6..e44bc94d 100644
--- a/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryConfig.java
+++ b/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryConfig.java
@@ -168,10 +168,15 @@ public @interface ResourceResolverFactoryConfig {
@AttributeDefinition(
name = "Optimize alias resolution",
description = "This flag controls whether to optimize"
- + " the alias resolution by creating an internal cache of aliases. NOTE: this setting will be removed "
- + " with the optimized resolution being the default (see SLING-12025).")
+ + " the alias resolution by creating an internal cache of aliases.")
boolean resource_resolver_optimize_alias_resolution() default true;
+ @AttributeDefinition(
+ name = "Alias Cache Init In Background",
+ description =
+ "This flag controls whether the vanity path cache will be initialized immediately or later as a background task.")
+ boolean resource_resolver_alias_cache_in_background() default true;
+
@AttributeDefinition(
name = "Allowed Optimized Alias Locations",
description = "This setting can contain a list of path prefixes, e.g. /libs/, /content/. If "
diff --git a/src/test/java/org/apache/sling/resourceresolver/impl/MockedResourceResolverImplTest.java b/src/test/java/org/apache/sling/resourceresolver/impl/MockedResourceResolverImplTest.java
index 57aad76e..83f3bf1c 100644
--- a/src/test/java/org/apache/sling/resourceresolver/impl/MockedResourceResolverImplTest.java
+++ b/src/test/java/org/apache/sling/resourceresolver/impl/MockedResourceResolverImplTest.java
@@ -271,6 +271,11 @@ public class MockedResourceResolverImplTest {
return true;
}
+ @Override
+ public boolean resource_resolver_alias_cache_in_background() {
+ return false;
+ }
+
@Override
public String[] resource_resolver_allowed_alias_locations() {
// deliberately put a mixture of paths with and without ending slash in here - both should be