Skip to content

Auto-port 5.0: Use VarHandle JCTools queues without Unsafe - #17239

Merged
normanmaurer merged 1 commit into
5.0from
auto-port-pr-17185-to-5.0
Aug 9, 2026
Merged

normanmaurer merged 1 commit into
5.0from
auto-port-pr-17185-to-5.0

Conversation

@netty-project-bot

Copy link
Copy Markdown
Contributor

Auto-port of #17185 to 5.0
Cherry-picked commit: 95012ca


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.

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)
@testlens-app

testlens-app Bot commented Aug 7, 2026

Copy link
Copy Markdown

✅ All tests passed ✅

🏷️ Commit: c29d28e
▶️ Tests: 230452 executed
⚪️ Checks: 12/12 completed


Learn more about TestLens at testlens.app.

@normanmaurer
normanmaurer merged commit ee15b09 into 5.0 Aug 9, 2026
13 checks passed
@normanmaurer
normanmaurer deleted the auto-port-pr-17185-to-5.0 branch August 9, 2026 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants