Skip to content

Extend org.springframework.core.task.VirtualThreadTaskExecutor with support for TaskDecorator. #32688

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

Closed
MihajloRa opened this issue Apr 22, 2024 · 2 comments
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: declined A suggestion or change that we don't feel we should currently apply

Comments

@MihajloRa
Copy link

MihajloRa commented Apr 22, 2024

Hello, as of v6.1.6 there is not support for TaskDecorator on the VirtualThreadTaskExecutor class. This would be a useful inclusion and would allow for an easier transition from ThreadPoolTaskExecutor with a custom TaskDecorator to a VirtualThreadTaskExecutor. Is this extension planned as of now and are there any reasons for it not being implemented initially? Or am I free to open a PR with this inclusion as it is quite a straight forward addition.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Apr 22, 2024
@jhoeller jhoeller added the in: core Issues in core modules (aop, beans, core, context, expression) label Apr 22, 2024
@jhoeller
Copy link
Contributor

The rationale is that VirtualThreadTaskExecutor should remain as lean as possible, without any customization options other than thread naming based on core Java policies.

For any Spring-style customization options (including Spring-style thread naming), we rather recommend SimpleAsyncTaskExecutor with setVirtualThreads(true) plus setTaskDecorator, setConcurrencyLimit etc.

Is there any reason you would need to stick with VirtualThreadTaskExecutor over SimpleAsyncTaskExecutor in general?

@snicoll snicoll added the status: waiting-for-feedback We need additional information before we can continue label Apr 23, 2024
@jhoeller
Copy link
Contributor

The VirtualThreadTaskExecutor javadoc points to SimpleAsyncTaskExecutor for those purposes already, so I don't see a need to document this further. Closing this issue on that basis.

@jhoeller jhoeller closed this as not planned Won't fix, can't repro, duplicate, stale Apr 24, 2024
@jhoeller jhoeller added status: declined A suggestion or change that we don't feel we should currently apply and removed status: waiting-for-feedback We need additional information before we can continue status: waiting-for-triage An issue we've not yet triaged or decided on labels Apr 24, 2024
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) status: declined A suggestion or change that we don't feel we should currently apply
Projects
None yet
Development

No branches or pull requests

4 participants