joerghoh commented on code in PR #40:
URL:
https://github.com/apache/sling-org-apache-sling-servlets-resolver/pull/40#discussion_r1271486430
##########
src/main/java/org/apache/sling/servlets/resolver/internal/helper/AbstractResourceCollector.java:
##########
@@ -197,5 +209,52 @@ private String getScriptExtension(String scriptName) {
}
return null;
}
+
+ /**
+ * Retrieves the list of children for a resource
+ * @param parent the resource for which the children should be retrieved
+ * @param useCaching if true try to read the list from the cache
+ * @return the children (or an empty list of no children are present)
+ */
+ static List<Resource> getChildrenList(Resource parent, boolean useCaching)
{
+
+ List<Resource> childList = new ArrayList<>();
+ if (useCaching) {
+
+ // init the caching structure
+ Map<String,List<Resource>> childrenListMap = new HashMap<>();
+ Map<String,Object> cache =
parent.getResourceResolver().getPropertyMap();
+ if (!cache.containsKey(CACHE_KEY_CHILDREN_LIST)) {
+ childrenListMap = new HashMap<>();
Review Comment:
This just happens during a the Script resolution for a request. Requests
should be as fast as possible, and therefor the lifetime of the assoicated
ResourceResolvers should be short (better miliseconds than seconds). In other
words, there should not be any need to call ``refresh()``.
But anyway, you are correct. I raised
[SLING-1183](https://issues.apache.org/jira/browse/SLING-11983) so that a
refresh will explicitly clear the propertyMap.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]