Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[improve][broker] Replace all ConcurrentOpenHashMap with the official ConcurrentHashMap in JDK #23216

Conversation

BewareMyPower
Copy link
Contributor

@BewareMyPower BewareMyPower commented Aug 24, 2024

Motivation

See #23215

Modifications

For broker related modules, including pulsar-broker, pulsar-websocket, managed-ledger,

  • Replace all ConcurrentOpenHashMap<T> with ConcurrentHashMap<T>
  • Replace all ConcurrentOpenHashSet<T> fields with ConcurrentHashMap<T, Boolean>
  • Replace unnecessary reflections in tests
  • Remove ConcurrentOpenHashSet since it's never used now

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository: BewareMyPower#34

@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Aug 24, 2024
@BewareMyPower BewareMyPower self-assigned this Aug 24, 2024
@BewareMyPower BewareMyPower added this to the 4.0.0 milestone Aug 24, 2024
@BewareMyPower BewareMyPower added the type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages label Aug 24, 2024
@ocadaruma
Copy link
Contributor

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.

@BewareMyPower
Copy link
Contributor Author

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.

@BewareMyPower BewareMyPower marked this pull request as draft August 25, 2024 07:36
@lhotari
Copy link
Member

lhotari commented Oct 9, 2024

Closing since the changes have been made in other PRs.

@lhotari lhotari closed this Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-not-needed Your PR changes do not impact docs type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants