Considering a clustered setup of Quartz and 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.
Description
Considering a clustered setup of Quartz and 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.
The declarative way i.e. the
@Scheduled
annotation is still limited, because itsconcurrentExecution
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
@DisallowedConcurrentExecution
annotation and theconcurrentExecution=SKIP
attribute of the @Scheduled annotation.