Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ByteBufferDataChunk.isReleased and ByteBufDataChunk.isReleased to use AtomicBoolean #6846

Merged
merged 6 commits into from
May 22, 2023

Conversation

romain-grecourt
Copy link
Contributor

Update ByteBufferDataChunk.isReleased and ByteBufDataChunk.isReleased to use an AtomicBoolean.
This prevents race conditions that may call the release callback more than once.

Fixes #6845

@romain-grecourt romain-grecourt self-assigned this May 18, 2023
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label May 18, 2023
@romain-grecourt romain-grecourt changed the title Update ByteBufferDataChunk.isReleased and ByteBufDataChunk.isReleased to use an AtomicBoolean Update ByteBufferDataChunk.isReleased and ByteBufDataChunk.isReleased to use AtomicBoolean May 18, 2023
ljnelson
ljnelson previously approved these changes May 18, 2023
Copy link
Member

@ljnelson ljnelson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM; restricted my review to the VarHandle stuff

ljnelson
ljnelson previously approved these changes May 19, 2023
Copy link
Member

@ljnelson ljnelson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM for VarHandle stuff

Copy link
Contributor

@danielkec danielkec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest I liked AtomicBoolean variant more, it had same better performance with better readability.

Copy link
Contributor

@danielkec danielkec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use var handle over int field rather than boolean

@romain-grecourt romain-grecourt dismissed danielkec’s stale review May 22, 2023 18:12

Requested changes added

@romain-grecourt romain-grecourt merged commit f22768d into helidon-io:helidon-2.x May 22, 2023
romain-grecourt added a commit to romain-grecourt/helidon that referenced this pull request May 24, 2023
… to use AtomicBoolean (helidon-io#6846)

* Update ByteBufferDataChunk.isReleased and ByteBufDataChunk.isReleased to use an AtomicBoolean.
Fixes helidon-io#6845

* Remove bit magic, add comments

* Use VarHandle

* use ExceptionInInitializerError instead of RuntimeException

* Use int instead of boolean for the volatile field

* fix checkstyle
@romain-grecourt romain-grecourt deleted the gh-6845 branch May 24, 2023 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MultiPart IllegalReferenceCountException: refCnt: 0, decrement: 1
3 participants