merlimat opened a new pull request, #4832: URL: https://github.com/apache/bookkeeper/pull/4832
### Motivation `OrderedExecutor.chooseThread()` — the path behind the keyless `submit()`/`execute()` overloads and `chooseThread(null)` — picks a thread using a single shared `java.util.Random` instance. `Random.nextInt()` is a CAS retry loop over one shared `AtomicLong` seed, so when many threads submit keyless tasks to a shared executor they all contend on the same cache line, purely to produce a thread index. ### Changes Use `ThreadLocalRandom.current().nextInt(...)` for the random routing (no shared state, no CAS contention) and remove the now-unused `rand` field. Verified with `TestOrderedExecutor` and `TestOrderedExecutorDecorators` (all pass) and module checkstyle. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
