sling-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] rombert commented on a change in pull request #5: SLING-7544 - improving optimized alias lookup to not block during int…
Date Wed, 21 Mar 2018 13:58:42 GMT
rombert commented on a change in pull request #5: SLING-7544 - improving optimized alias lookup
to not block during int…
URL: https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/5#discussion_r176088778
 
 

 ##########
 File path: src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java
 ##########
 @@ -1027,12 +1044,28 @@ private boolean addEntry(final Map<String, List<MapEntry>>
entryMap, final Strin
      */
     private Map<String, Map<String, String>> loadAliases(final ResourceResolver
resolver) {
         final Map<String, Map<String, String>> map = new ConcurrentHashMap<>();
-        final String queryString = "SELECT sling:alias FROM nt:base WHERE sling:alias IS
NOT NULL";
-        final Iterator<Resource> i = resolver.findResources(queryString, "sql");
-        while (i.hasNext()) {
-            final Resource resource = i.next();
-            loadAlias(resource, map);
-        }
+        String queryString = "SELECT sling:alias FROM nt:base WHERE sling:alias IS NOT NULL";
+		if (this.factory.isForceNoAliasTraversal()) {
+			queryString += " option(traversal fail)";
+		}
+		while (true){
+	        try {
+		        final Iterator<Resource> i = resolver.findResources(queryString, "sql");
+		        while (i.hasNext()) {
+		            final Resource resource = i.next();
+		            loadAlias(resource, map);
+		        }
+		        break;
+	        } catch (Exception e) {
+	        	log.debug("Expected index not available and no traversal enforced", e);
+	            try {
+	                TimeUnit.MILLISECONDS.sleep(getTraversalTimer());
+	            } catch (InterruptedException ex) {
+	                log.warn("Interrupted while sleeping");
 
 Review comment:
   The root exception should also be logged. But this is executed in the thread started in
MapEntries.init(), right? This means that a failure will not be propagated to the caller.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message