pulsar
pulsar copied to clipboard
[improve][broker] Replace all ConcurrentOpenHashMap with the official ConcurrentHashMap in JDK
Motivation
See https://github.com/apache/pulsar/issues/23215
Modifications
For broker related modules, including pulsar-broker, pulsar-websocket, managed-ledger,
- Replace all
ConcurrentOpenHashMap<T>withConcurrentHashMap<T> - Replace all
ConcurrentOpenHashSet<T>fields withConcurrentHashMap<T, Boolean> - Replace unnecessary reflections in tests
- Remove
ConcurrentOpenHashSetsince it's never used now
Documentation
- [ ]
doc - [ ]
doc-required - [x]
doc-not-needed - [ ]
doc-complete
Matching PR in forked repository
PR in forked repository: https://github.com/BewareMyPower/pulsar/pull/34
Hi, the change looks make sense.
For ConcurrentOpenHashSet, how about replacing type declarations with Set and use ConcurrentHashMap.newKeySet() ?
To express the Set type, it's more straightforward than ConcurrentHashMap<T, Boolean> and helps the reader IMO.
declarations with Set and use ConcurrentHashMap.newKeySet() ?
Good suggestion. I will adopt this suggestion.
BTW, I will split this PR into multiple parts because of there are many changes. So let me mark it drafted now and push more PRs.
Closing since the changes have been made in other PRs.