Repository navigation
Auto-port 5.0: Use VarHandle JCTools queues without Unsafe - #17239
Merged
Merged
Conversation
Motivation: Netty currently falls back to JCTools atomic queues when `Unsafe` is unavailable. JCTools 4.0.6 provides VarHandle-based queues that avoid `Unsafe` while offering a more efficient alternative to the atomic implementations. Modification: Added and shaded the `jctools-core-jdk11` dependency. Updated the queue factories in `PlatformDependent` to prefer implementations in this order: 1. Unsafe-based queues when `Unsafe` is available. 2. VarHandle-based queues when `Unsafe` is unavailable but VarHandle is supported. 3. Atomic queues as the fallback. Added test coverage for the VarHandle queue selection when `Unsafe` is disabled. Result: Fixes #17157. --------- Signed-off-by: Arnab Nandy <[email protected]> Co-authored-by: Chris Vest <[email protected]> (cherry picked from commit 95012ca)
✅ All tests passed ✅🏷️ Commit: c29d28e Learn more about TestLens at testlens.app. |
normanmaurer
approved these changes
Aug 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Auto-port of #17185 to 5.0
Cherry-picked commit: 95012ca
Motivation:
Netty currently falls back to JCTools atomic queues when
Unsafeis unavailable. JCTools 4.0.6 provides VarHandle-based queues that avoidUnsafewhile offering a more efficient alternative to the atomic implementations.Modification:
Added and shaded the
jctools-core-jdk11dependency. Updated the queue factories inPlatformDependentto prefer implementations in this order:Unsafeis available.Unsafeis unavailable but VarHandle is supported.Added test coverage for the VarHandle queue selection when
Unsafeis disabled.Result:
Fixes #17157.