Skip to content

Change "synchronized" to reentrant lock for virtual-threads #1188

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

Merged
merged 2 commits into from
Oct 15, 2024

Conversation

omercelikceng
Copy link
Contributor

initialize method in AzureWebProxyInvoker class
initialize method in AzureFunctionInstanceInjector class
initialize method in FunctionInvoker class
addDispatchHandler and dispatch methods in ServerlessAsyncContext class
INSTANCE method in JsonMasker class
memoize method in FunctionLookupHelper class

were 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.

@olegz olegz merged commit f637b98 into spring-cloud:main Oct 15, 2024
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.

2 participants