Github user michaelandrepearce commented on the issue:
https://github.com/apache/activemq-artemis/pull/2484
> > > CursorIterator:hasNext
> >
> >
> > Im bit concerned with this doing a dirty read, as this isnt something
that is trigger an ascyn action, in actual fact the hasNext is purposefully
synchronized. (especially as recently some concurrency issues have been found
in paging (e.g. howards current pr) im sensitive to us being too hap hazard
here.
>
> I don't get why isPaging() in hasNext() needs to be consistent. The
paging status can change after isPaging() unless we readlock isPaging() and
subsequent operations. Without readlock, a) if isPaging() returns true, but the
other thread set it to false, subsequent next() call reads no data and returns
null; b) if isPaging() returns false, but the other thread set it to true(a new
message coming), deliverAsync would be called later anyway.
if thats the case then the sync method could be removed also, though i
think @clebertsuconic has given some further info to why this is like it is.
---