joerghoh commented on PR #10: URL: https://github.com/apache/sling-org-apache-sling-scripting-javascript/pull/10#issuecomment-2532966857
I am aware of a few instances of problems with javascript-based Sling Models, which we investigated but never come to a good conclusion. These could indeed be caused by the problems of double locking (see [Double-checked locking is broken](https://www.cs.cornell.edu/courses/cs6120/2019fa/blog/double-checked-locking/#double-checked-locking-is-broken), thanks @rombert for that link). That means that marking the entire method as synchronized could prevent this. Regarding performance impact: I cannot say much about that, as I have not experience with that code in production usage. But to avoid marking the entire method as ```synchronized``` we have to update ```njo``` in an atomic way, and therefor turn the definition into something like ``` AtomicReference<NativeJavaObject> njo; ``` -- 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: dev-unsubscr...@sling.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org