lhotari opened a new pull request #10280:
URL: https://github.com/apache/pulsar/pull/10280


   ### Motivation
   
   In Java, updating double or long values isn't atomic and thread safe.
   Explained in [JLS 
17.7](https://docs.oracle.com/javase/specs/jls/se8/html/jls-17.html#jls-17.7)
   > For the purposes of the Java programming language memory model, a single 
write to a non-volatile long or double value is treated as two separate writes: 
one to each 32-bit half. This can result in a situation where a thread sees the 
first 32 bits of a 64-bit value from one write, and the second 32 bits from 
another write.
   
   There are several mutable non-volatile `long` fields in `ManagedLedgerImpl` 
which are accessed from multiple threads.
   
   ### Modifications
   
   Make the fields volatile to fix the thread safety issues.
   
   
   


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


Reply via email to