Skip to content

GH-11042: Fix race condition in the ControlBusCommandRegistry#11046

Merged
cppwfs merged 2 commits into
spring-projects:mainfrom
artembilan:GH-11042
Jun 5, 2026
Merged

GH-11042: Fix race condition in the ControlBusCommandRegistry#11046
cppwfs merged 2 commits into
spring-projects:mainfrom
artembilan:GH-11042

Conversation

@artembilan
Copy link
Copy Markdown
Member

Fixes: #11042

The ControlBusCommandRegistry can be accessed (and populated) concurrently. Therefore, it is better to protect its internal from the ConcurrentModificationException

  • Use ConcurrentHashMap and synchronized in the ControlBusCommandRegistry whenever concurrent access is possible.

Auto-cherry-pick to 7.0.x & 6.5.x

…egistry

Fixes: spring-projects#11042

The `ControlBusCommandRegistry` can be accessed (and populated) concurrently.
Therefore, it is better to protect its internal from the `ConcurrentModificationException`

* Use `ConcurrentHashMap` and `synchronized` in the `ControlBusCommandRegistry`
whenever concurrent access is possible.

**Auto-cherry-pick to `7.0.x` & `6.5.x`**
@artembilan artembilan requested a review from cppwfs June 4, 2026 18:01
Copy link
Copy Markdown
Contributor

@cppwfs cppwfs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch on using ConcurrentHashMap!

Have a question or two on the synchronization.

Copy link
Copy Markdown
Contributor

@cppwfs cppwfs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the changes!

This looks great!

@cppwfs cppwfs merged commit f0a2f65 into spring-projects:main Jun 5, 2026
3 checks passed
spring-builds pushed a commit that referenced this pull request Jun 5, 2026
* GH-11042: Fix race condition in the ControlBusCommandRegistry

Fixes: #11042

The `ControlBusCommandRegistry` can be accessed (and populated) concurrently.
Therefore, it is better to protect its internal from the `ConcurrentModificationException`

* Use `ConcurrentHashMap` and `synchronized` in the `ControlBusCommandRegistry`
whenever concurrent access is possible.

* No need in `synchronized (this.controlBusCommands)`

(cherry picked from commit f0a2f65)
spring-builds pushed a commit that referenced this pull request Jun 5, 2026
* GH-11042: Fix race condition in the ControlBusCommandRegistry

Fixes: #11042

The `ControlBusCommandRegistry` can be accessed (and populated) concurrently.
Therefore, it is better to protect its internal from the `ConcurrentModificationException`

* Use `ConcurrentHashMap` and `synchronized` in the `ControlBusCommandRegistry`
whenever concurrent access is possible.

* No need in `synchronized (this.controlBusCommands)`

(cherry picked from commit f0a2f65)
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.

The ControlBusCommandRegistry.controlBusCommands must be a ConcurrentHashMap

2 participants