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

When virtual threads are enabled, configure Spring Integration's task scheduler to use them #41695

Conversation

facewise
Copy link
Contributor

@facewise facewise commented Aug 5, 2024

Motivation

Former IntegrationAutoConfiguration.IntegrationTaskSchedulerConfiguration was not aware of virtual threads. It means ThreadPoolTaskScheduler was instantiated regardless of capability of virtual threads when you use spring-boot-starter-integration.

Changes

Now IntegrationAutoConfiguration.IntegrationTaskSchedulerConfiguration determines a proper TaskScheduler bean to be instantiated via @ConditionalOnThreading.

If virtual threads is enabled, SimpleAsyncTaskScheduler will be instantiated, otherwise works as is.

This can resolve #41188.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Aug 5, 2024
@mhalbritter mhalbritter changed the title Make IntegrationTaskSchedulerConfiguration virtual threads aware When virtual threads are enabled, configure Spring Integration's task scheduler to use them Aug 5, 2024
@mhalbritter mhalbritter added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Aug 5, 2024
@mhalbritter mhalbritter added this to the 3.4.x milestone Aug 5, 2024
@mhalbritter
Copy link
Contributor

Thanks a lot!

@facewise
Copy link
Contributor Author

facewise commented Aug 6, 2024

@mhalbritter Oh, I think I made a broken test. Sorry.
I don't know how to run virtual threads enabled tests with @EnabledForJreRange(min = JRE.JAVA_21) on my pc.

@mhalbritter
Copy link
Contributor

Don't worry, I'll fix it. The command to run is gradle test -PtoolchainVersion=21.

@facewise
Copy link
Contributor Author

facewise commented Aug 6, 2024

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When virtual threads are enabled, configure Spring Integration's task scheduler to use them
3 participants