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

Allow CronTrigger to resume from specified timestamp [SPR-14909] #19475

Closed
spring-projects-issues opened this issue Nov 15, 2016 · 1 comment
Closed
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Nov 15, 2016

Jean-Philippe Legault opened SPR-14909 and commented

Allowing ReschedulingRunnable to receive a TriggerContext on creation (instead of always creating a new one) and updating the TaskScheduler interface to add a new signature "ScheduledFuture<?> schedule(Runnable task, Trigger trigger, TriggerContext initialContext);" would allow me to resume a task that was created with a Trigger trough the TaskScheduler.

The current behavior is that a job scheduled with the TaskScheduler with the CronTrigger "0 0 0 */2 * *" task will run in 2 days from now, no matter what. Updating this would allow me to resume a task.

As an example, if I have the CronTrigger "0 0 0 */2 * *", and I know that the last time this task ran was yesterday, I could setup an initial TriggerContext to be passed along the TaskScheduler and used at the creation of the first ReschedulingRunnable instead of using a new one. The following ReschedulingRunnable that will be created would use the current Context, which mean the behavior would not change after the first pass.


Issue Links:

@spring-projects-issues spring-projects-issues added type: enhancement A general enhancement in: core Issues in core modules (aop, beans, core, context, expression) labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 5.x Backlog milestone Jan 11, 2019
@jhoeller jhoeller changed the title Allow ReschedulingRunnable to receive a TriggerContext on creation [SPR-14909] Allow CronTrigger to resume from specified timestamp [SPR-14909] Jan 4, 2024
@jhoeller jhoeller self-assigned this Jan 4, 2024
@jhoeller jhoeller modified the milestones: 6.x Backlog, 6.1.3 Jan 4, 2024
@jhoeller
Copy link
Contributor

jhoeller commented Jan 4, 2024

I'm introducing static factory methods on CronTrigger with support for a resumptionTimestamp, coming with traditional semantics as resumeLenientExecution method (calculating the first trigger firing from the given timestamp but every subsequent firing on the previous completion time) and also with fixed-execution semantics as resumeFixedExecution (not missing any original trigger firing even on resumption, calculating subsequent firings from the previous scheduled time).

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

2 participants