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

Eliminate synchronized block to avoid thread pinning in SingletonSupplier #31227

Merged
merged 1 commit into from
Sep 14, 2023

Conversation

quaff
Copy link
Contributor

@quaff quaff commented Sep 14, 2023

No description provided.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Sep 14, 2023
@jhoeller
Copy link
Contributor

Have you seen a concrete effect within a virtual thread here? As long as the target supplier does not do any I/O or other blocking operations, this should not make a difference. That said, SingletonSupplier comes as a reusable component, so I can see why it should be able to deal with blocking scenarios as well.

@quaff
Copy link
Contributor Author

quaff commented Sep 14, 2023

It's very common that target supplier invoke I/O, for example querying data from database. This is inspired by This Tomcat mailing list discussion from #31212.

@jhoeller
Copy link
Contributor

Internally we only use SingletonSupplier for lazy data structures and lazy bean references. So one-time late initialization only, quite different from per-operation synchronization in a database driver. Nevertheless, this looks easy enough to revise, even if just as a defensive measure.

@jhoeller jhoeller added in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Sep 14, 2023
@jhoeller jhoeller self-assigned this Sep 14, 2023
@jhoeller jhoeller added this to the 6.1.0-RC1 milestone Sep 14, 2023
@jhoeller jhoeller merged commit 4639738 into spring-projects:main Sep 14, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants