Skip to content

fix: use TreeMap to ensure consistent iteration order in ThreadPoolStatusChecker#16154

Open
Senrian wants to merge 1 commit intoapache:3.3from
Senrian:fix/threadpool-status-checker-test-order
Open

fix: use TreeMap to ensure consistent iteration order in ThreadPoolStatusChecker#16154
Senrian wants to merge 1 commit intoapache:3.3from
Senrian:fix/threadpool-status-checker-test-order

Conversation

@Senrian
Copy link

@Senrian Senrian commented Mar 22, 2026

What is the purpose of the change?

Fix the flaky test ThreadPoolStatusCheckerTest where Map.entrySet() iteration order is undefined under the Java Memory Model, causing test failures when the map returns entries in a different order than expected.

Fix

Use TreeMap instead of raw Map to sort entries by port key before building the status message. This guarantees deterministic output regardless of JVM implementation or hash map iteration order.

Fixes #16152
Fixes #16153

Fixes the flaky test ThreadPoolStatusCheckerTest where Map.entrySet()
iteration order is undefined. Using TreeMap sorts entries by port key,
making the status message deterministic.
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.

[Bug] ThreadPoolStatusCheckerTest#test fails when collection order is shuffled with NonDex

1 participant