Jason918 commented on PR #16125:
URL: https://github.com/apache/pulsar/pull/16125#issuecomment-1190096730

   > > @lhotari OK, I get your point. It's the array elements, not the array 
object. This concern make sense. My guess on this is that there are 
happen-before relations here:
   > > 
   > > * `put()` ->
   > > * `data[tailIndex.value] = e;//write Ops` -->
   > > * `SIZE_UPDATER.getAndIncrement(...) in put()` -->
   > > * `SIZE_UPDATER.get() in poll()` -->
   > > * `T item = data[headIndex.value];//Read Ops`.
   > >   So the array element written by `put` is always visible to `poll`.
   > > 
   > > Not 100% sure about this :)
   > 
   > Good analysis @Jason918 . Yes it seems that SIZE_UPDATER saves it in this 
case, however there's a risk that there's an access path which isn't thread 
safe.
   
   Sure, we can try to construct a unit test to verify this 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