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_r182002608
 
 

 ##########
 File path: 
src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java
 ##########
 @@ -128,9 +133,9 @@
 
     private Map <String,List <String>> vanityTargets;
 
-    private volatile Map<String, Map<String, String>> aliasMap;
+    private Map<String, Map<String, String>> aliasMap;
     
-       private volatile boolean isAliasMapInitialized = false;
+       private boolean isAliasMapInitialized = false;
 
 Review comment:
   Sorry for the late reply, I missed your additional changes.
   
   Right now the situation is no better than in the original submission. You're 
reading/writing to `aliasMap` and `isAliasMapInitialized` from different 
threads and there is no guarantee that the changes will be visible - no 
synchronized/volatile/etc.
   
   The aliasMap may be a concurrent implementation, but the reference setting 
is not thread-safe. The solution you choose should at least:
   
   - ensure that aliasMap/isAliasMapInitialized values are changed atomically
   - access to aliasMap/isAliasMapInitialized is done in a thread-safe manner

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to