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

Change the use of synchronized in the getBinder method of DefaultBinderFactory class for virtual-threads compliant #3005

Merged
merged 1 commit into from
Sep 24, 2024

Conversation

ferblaca
Copy link
Contributor

Resolves #3004

This pull request includes changes to the DefaultBinderFactory class to improve thread safety by introducing a ReentrantLock. The most important changes include adding the lock, modifying the getBinder method to use the lock, and ensuring the lock is released properly.

Thread safety improvements:

…erFactory class for virtual-threads

The getBinder method in DefaultBinderFactory was made thread-safe using ReentrantLock. This commit ensures that the method is friendly for virtual threads to avoid blocking and pinning. The lock is acquired at the beginning of the method and released in a finally block to ensure it is always released, even if an exception occurs. Fixes spring-cloudgh-3004
@olegz olegz merged commit eecec41 into spring-cloud:main Sep 24, 2024
1 check passed
@olegz olegz added this to the 4.2.0-M2 milestone Sep 24, 2024
@ferblaca ferblaca deleted the GH-3004 branch September 26, 2024 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants