Skip to content

To add support for non-concurrent task execution in a clustered environment #44048

Closed

Description

Description

Considering a clustered setup of Quartz, the need for a recurrent task to be triggered only once its previous execution is terminated can be addressed using the programmatic way i.e. the Quartz API.

final JobDetail job = JobBuilder.newJob(MyTask.class).withIdentity(identity, group).build();
final Trigger trigger = TriggerBuilder.newTrigger()
        .withIdentity(identity, group)
        .withSchedule(CronScheduleBuilder.cronSchedule(cron))
        .build();
scheduler.schedule(job, trigger);

@DisallowConcurrentExecution
public static final class MyTask implements Job {
    @Override
    public void execute(JobExecutionContext context) {
        // my work
    }
}

The declarative way i.e. the @Scheduled annotation is still limited, because its concurrentExecution attribute manages non-concurrency locally on a single node i.e. a single application instance, but not globally, considering every nodes i.e. every application instances.

Therefore, the request is to provide an equivalent solution design using the declarative way i.e. an annotation like the @scheduled one.

Implementation ideas

  • To bridge the @DisallowedConcurrentExecution annotation and the concurrentExecution=SKIP attribute of the @scheduled annotation.
  • To design another annotation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions