Skip to content

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

Merged
olegz merged 1 commit intospring-cloud:mainfrom
ferblaca:GH-3004
Sep 24, 2024
Merged

Change the use of synchronized in the getBinder method of DefaultBinderFactory class for virtual-threads compliant#3005
olegz merged 1 commit intospring-cloud:mainfrom
ferblaca:GH-3004

Conversation

@ferblaca
Copy link
Copy Markdown
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants