afs commented on issue #2787:
URL: https://github.com/apache/jena/issues/2787#issuecomment-2440078972

   > The `LazyHolder` replaces only the `synchronized(JenaSystem.class)` 
mechanism. Unlike the synchronized block, the JVM ensures that the `LazyHolder` 
is only accessed once, so there’s no need for double-checking with `if 
(initialized) return;`. This makes it both efficient and more robust.
   
   (Because this is critical in Jena, forgive me for wanting to get into the 
details.)
   
   I don't quite understand "more robust" here.  The second thread is allowed 
to continue once initialized is set true. LazyHolder is 
   (I don't have a solution for that and it may be a non-issue because the 
second thread bumps into an initializing class.)
   
   Efficiency - in our case, there isn't much different because the volatile is 
still there.
   
   


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

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to