Skip to content

[improve][broker] Added synchronized for sendMessages in Non-Persistent message dispatchers #24

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

Closed
wants to merge 1 commit into from

Conversation

sandeep-mst
Copy link
Collaborator

@sandeep-mst sandeep-mst commented Jun 5, 2025

Fixes apache#24379

Motivation

We have observed inconsistency with the usage of synchronized keyword while dispatching messages to the consumer across different dispatchers.
The following are not using synchronized keyword while filtering and sending messages to the consumers.

The rest of the dispatchers including all the persistent dispatchers and NonPersistentDispatcherMultipleConsumers use synchronized while sending messages. This causes inconsistencies across different dispatchers while running server-side filters with multiple producers and a single consumer as it will get multi-threaded. This is even more a case when server-side filter code is not thread-safe.

Modifications

Added synchronized keyword at the following two method calls.

Verifying this change

  • Make sure that the change passes the CI checks.

(Please pick either of the following options)

This change is a trivial rework / code cleanup without any test coverage.

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

Documentation

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

Matching PR in forked repository

PR in forked repository:

@sandeep-mst
Copy link
Collaborator Author

Closing as PR is merged upstream and synced to fork master.
apache#24386

@sandeep-mst sandeep-mst closed this Jun 6, 2025
@sandeep-mst sandeep-mst deleted the dispatchers-24379 branch June 6, 2025 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

[Enhancement] Inconsistency across different message dispatchers while sending messages
1 participant