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

[Idea] Changing the use of synchronized in the getBinder method of DefaultBinderFactory class for virtual threads #3004

Closed
ferblaca opened this issue Sep 24, 2024 · 1 comment · Fixed by #3005

Comments

@ferblaca
Copy link
Contributor

The getBinder method in the DefaultBinderFactory class is marked as synchronized. However, the use of synchronized can be detrimental to performance when using Virtual Threads in Java, as it can introduce deadlocks that negatively affect concurrency and performance.

The getBinder method can be invoked multiple times during the life cycle of the application:

  • During initialisation: When the application starts and configures the different message channels.
  • At runtime: Every time a new binder is needed for a specific message channel.

So it would be nice to replace synchronized with a more suitable concurrency mechanism, like ReentrantLock.

If you think it's right, we can contribute it.

@ferblaca
Copy link
Contributor Author

We have created the PR #3005 with the change I was talking about so that, if you think it makes sense, we can speed up the change.

@olegz olegz closed this as completed in 2f82f3c Sep 24, 2024
olegz added a commit that referenced this issue Sep 24, 2024
Change the use of synchronized in the getBinder method of DefaultBinderFactory class for virtual-threads compliant
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant