rombert commented on a change in pull request #24:
URL: 
https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/24#discussion_r520421888



##########
File path: 
src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryActivator.java
##########
@@ -128,6 +129,9 @@
 
     private volatile ResourceResolverFactoryConfig config = DEFAULT_CONFIG;
 
+    /** Alias path whitelist */
+    private AtomicReferenceArray<String> aliasPathAllowList;

Review comment:
       I am not sure why a `volatile CopyOnWriteArrayList` wouldn't work:
   
   - The `volatile` modifier ensures that that the readers of the field always 
get the latest value - so changing the reference works
   - the `CopyOnWriteArrayList` implementation is thread-safe internally, so 
changes made by one thread are visible to other threads
   
   Maybe SonarCloud flagged a volatile field holding a non-thread-safe list 
implementation, like `ArrayList`? That would not solve the second problem 
listed above.
   
   I think using a List is much more easier to understand than an 
AtomicReferenceArray, so I'd prefer that if at all possible.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to