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

ThreadPoolTaskExecutor deprecated? #34273

Closed
adnsimona opened this issue Jan 16, 2025 · 2 comments
Closed

ThreadPoolTaskExecutor deprecated? #34273

adnsimona opened this issue Jan 16, 2025 · 2 comments
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: invalid An issue that we don't feel is valid

Comments

@adnsimona
Copy link

Hi.

We're updating Spring Boot from 3.3 to 3.4.

I found a deprecation warning that we forgot to handle with the 3.0 upgrade:
ListenableFuture.
We are not using this directly, but overriding ThreadPoolTaskExecutor's submitListenable method.
I don't see any deprecation warning on the ThreadPoolTaskExecutor class, nor it's functions that uses ListenableFuture.
It is also implementing AsyncListenableTaskExecutor that is also deprecated. From this I guess this class should be also deprecated.

My goal is now to replace this ThreadPoolTaskExecutor with a close equivalent.
Though I didn't found yet what I'm looking for.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jan 16, 2025
@bclozel
Copy link
Member

bclozel commented Jan 16, 2025

AsyncListenableTaskExecutor itself is deprecated and has been removed in #33809. As of Spring Framework 7.0, ThreadPoolTaskExecutor doesn't implement this interface anymore but still exists.

The migration path in your case would be to use one of the other submit methods instead and stop using ListenableFuture completely.

@bclozel bclozel closed this as not planned Won't fix, can't repro, duplicate, stale Jan 16, 2025
@bclozel bclozel added status: invalid An issue that we don't feel is valid in: core Issues in core modules (aop, beans, core, context, expression) and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Jan 16, 2025
@jhoeller
Copy link
Contributor

Indeed, ThreadPoolTaskExecutor is not deprecated, just the ListenableFuture-based methods (as inherited from AsyncListenableTaskExecutor) are deprecated along with the ListenableFuture type itself. We recommend staying with the same executor, just switching to the submitCompletable method based on CompletableFuture for task submission purposes.

If you are overriding ListenableFuture-based methods in a custom executor subclass, feel free to keep doing so for the time being. Only as of 7.0, those methods and the ListenableFuture type itself are going to be removed, at which point you'll have to remove your overriding methods as well.

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: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

4 participants