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

Deprecate AsyncTaskExecutor.execute(Runnable task, long startTimeout) #27959

Closed
nytro77 opened this issue Jan 20, 2022 · 2 comments
Closed

Deprecate AsyncTaskExecutor.execute(Runnable task, long startTimeout) #27959

nytro77 opened this issue Jan 20, 2022 · 2 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Milestone

Comments

@nytro77
Copy link

nytro77 commented Jan 20, 2022

Affects: 5.3.15


The ThreadPoolTaskExecutor implements the AsyncTaskExecutor interface, so it has the method void execute(Runnable task, long startTimeout).

The implementation for that method silently ignores the timeout. It just calls the execute method without the timeout specified.

public void execute(Runnable task, long startTimeout) {
    execute(task);
}

The Javadoc for the method says that startTimeout is intended as a hint to the executor, but if the implementation does not support it at all I think it would be better to throw a org.springframework.core.task.TaskRejectedException instead.

To just silently ignore the startTimeout gives no clue to the caller that an unsupported method is called.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jan 20, 2022
@sbrannen sbrannen added the in: core Issues in core modules (aop, beans, core, context, expression) label Jan 20, 2022
@sbrannen
Copy link
Member

At the very least, I think we should introduce custom Javadoc for that method to point out that the startTimeout argument is ignored, and we could also log a warning/info/debug message.

@sbrannen sbrannen added this to the Triage Queue milestone Jan 20, 2022
@jhoeller
Copy link
Contributor

jhoeller commented Feb 1, 2022

Start timeouts were technically meant as a hint in the sense of "to be ignored if it cannot be respected", just like transaction timeouts or statement timeouts with JDBC which are often effectively ignored by the driver implementation as well.

That said, since the only implementation which actually supported start timeouts (WorkManagerTaskExecutor) went away in 6.0, I'd rather deprecate the method in 5.3.x and possibly remove it in 6.0 completely. I'll repurpose this issue accordingly.

@jhoeller jhoeller added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Feb 1, 2022
@jhoeller jhoeller modified the milestones: Triage Queue, 5.3.16 Feb 1, 2022
@jhoeller jhoeller self-assigned this Feb 1, 2022
@jhoeller jhoeller changed the title ThreadPoolTaskExecutor.execute(Runnable task, long startTimeout) ignores timeout Deprecate AsyncTaskExecutor.execute(Runnable task, long startTimeout) Feb 1, 2022
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

No branches or pull requests

4 participants