You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by GitBox <gi...@apache.org> on 2020/10/20 10:02:18 UTC

[GitHub] [sling-org-apache-sling-models-impl] raducotescu commented on pull request #21: SLING-9834 - [Sling Models] Caching bug with reused Servlet requests

raducotescu commented on pull request #21:
URL: https://github.com/apache/sling-org-apache-sling-models-impl/pull/21#issuecomment-712740266


   SonarCube is right and you have the rule's explanation: "The story is very similar for synchronizing on parameters; two different threads running the method in parallel could pass two different object instances in to the method as parameters, completely undermining the synchronization."
   
   Usually you should synchronize on objects you control. For the case where the `adaptable` is a request you don't need to do any synchronization. For the other case I think it's sufficient to use `adapterCache.computeIfAbsent`.


----------------------------------------------------------------
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:
users@infra.apache.org