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

Support one-time @Scheduled tasks #31211

Closed
marceloverdijk opened this issue Sep 13, 2023 · 2 comments
Closed

Support one-time @Scheduled tasks #31211

marceloverdijk opened this issue Sep 13, 2023 · 2 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Milestone

Comments

@marceloverdijk
Copy link

marceloverdijk commented Sep 13, 2023

As discussed here #31210 it would be useful to be able to only specify an initialDelay for @Scheduled task to run in only once. So without cron/fixedDelay/fixedRate to be specified.

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

Some background.

Many used something like @Scheduled(initialDelay = 5, fixedDelay = Long.MAX_VALUE) for this, but that resulted in an unexpected ArithmeticException in 6.0.10 (#30754).

This was fixed in 6.0.11 but in other cases like @Scheduled(initialDelay = 5, fixedDelay = Integer.MAX_VALUE, timeUnit = TimeUnit.MINUTES) this still happens.

So it would be nice to be able to configure an one-time task without setting a fixedDelay in a very far future.

@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 13, 2023
@jhoeller jhoeller self-assigned this Sep 13, 2023
@jhoeller jhoeller added this to the 6.1.0-M5 milestone Sep 13, 2023
@marceloverdijk
Copy link
Author

Thx @jhoeller that was fast ;-)

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

3 participants