-
Notifications
You must be signed in to change notification settings - Fork 566
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
Update ByteBufferDataChunk.isReleased and ByteBufDataChunk.isReleased to use AtomicBoolean #6846
Conversation
… to use an AtomicBoolean. Fixes helidon-io#6845
tests/integration/se-gh-6845/src/main/java/io/helidon/tests/integration/gh6845/Main.java
Outdated
Show resolved
Hide resolved
common/http/src/main/java/io/helidon/common/http/ByteBufferDataChunk.java
Outdated
Show resolved
Hide resolved
common/http/src/main/java/io/helidon/common/http/ByteBufferDataChunk.java
Outdated
Show resolved
Hide resolved
webserver/webserver/src/main/java/io/helidon/webserver/ByteBufDataChunk.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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
There was a problem hiding this 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
common/http/src/main/java/io/helidon/common/http/ByteBufferDataChunk.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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.
There was a problem hiding this 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
… 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
Update
ByteBufferDataChunk.isReleased
andByteBufDataChunk.isReleased
to use an AtomicBoolean.This prevents race conditions that may call the release callback more than once.
Fixes #6845