lhotari commented on PR #4171:
URL: https://github.com/apache/bookkeeper/pull/4171#issuecomment-1887638998

   > The `changingEnsemble` is already protected by synchronized, why do we 
need volatile?
   
   @hangc0276 `changingEnsemble` is mutated under `synchronized (metadataLock) 
{`. A mutation in a synchronized block isn't sufficient alone. it would have to 
be read under `synchronized (metadataLock) {` for it to be thread safe without 
considering any other means for achieving "happens-before". Making it 
`volatile` is one way to fix the current issue.


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

Reply via email to