From c8d802b882ffe7bf2a4c739d3bafada61411b26e Mon Sep 17 00:00:00 2001 From: Manyanda Chitimbo Date: Fri, 19 May 2023 17:18:01 +0200 Subject: [PATCH] fix(quartz): ensure that invoker is properly initialized in QuartzJobDefinition#schedule (cherry picked from commit e29869d11a6244c7ae7235d92a9e18544a9354ab) --- .../java/io/quarkus/quartz/runtime/QuartzSchedulerImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/quartz/runtime/src/main/java/io/quarkus/quartz/runtime/QuartzSchedulerImpl.java b/extensions/quartz/runtime/src/main/java/io/quarkus/quartz/runtime/QuartzSchedulerImpl.java index e0207272ec9a1..e8a44f7a16ddc 100644 --- a/extensions/quartz/runtime/src/main/java/io/quarkus/quartz/runtime/QuartzSchedulerImpl.java +++ b/extensions/quartz/runtime/src/main/java/io/quarkus/quartz/runtime/QuartzSchedulerImpl.java @@ -807,6 +807,8 @@ public boolean isBlocking() { Optional> triggerBuilder = createTrigger(identity, scheduled, cronType, runtimeConfig, jobDetail); if (triggerBuilder.isPresent()) { + invoker = SimpleScheduler.initInvoker(invoker, skippedExecutionEvent, successExecutionEvent, + failedExecutionEvent, concurrentExecution, skipPredicate); org.quartz.Trigger trigger = triggerBuilder.get().build(); QuartzTrigger existing = scheduledTasks.putIfAbsent(identity, new QuartzTrigger(trigger.getKey(), new Function<>() { @@ -826,8 +828,6 @@ public org.quartz.Trigger apply(TriggerKey triggerKey) { throw new IllegalStateException("A job with this identity is already scheduled: " + identity); } - invoker = SimpleScheduler.initInvoker(invoker, skippedExecutionEvent, successExecutionEvent, - failedExecutionEvent, concurrentExecution, skipPredicate); try { scheduler.scheduleJob(jobDetail, trigger); } catch (SchedulerException e) {