-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Avoid NPE when scheduled method identity has been renamed #25407
Conversation
@@ -277,8 +277,8 @@ public QuartzScheduler(SchedulerContext context, QuartzSupport quartzSupport, Sc | |||
org.quartz.Trigger trigger = triggerBuilder.build(); | |||
org.quartz.Trigger oldTrigger = scheduler.getTrigger(trigger.getKey()); | |||
if (oldTrigger != null) { | |||
scheduler.rescheduleJob(trigger.getKey(), | |||
triggerBuilder.startAt(oldTrigger.getNextFireTime()).build()); | |||
trigger = triggerBuilder.startAt(oldTrigger.getNextFireTime()).build(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re-assign the trigger with the proper start time as it is used in
quarkus/extensions/quartz/runtime/src/main/java/io/quarkus/quartz/runtime/QuartzScheduler.java
Line 303 in c4aa894
scheduledTasks.put(identity, new QuartzTrigger(trigger, invoker, |
@@ -292,7 +292,8 @@ public QuartzScheduler(SchedulerContext context, QuartzSupport quartzSupport, Sc | |||
oldTrigger = scheduler.getTrigger(new TriggerKey(identity + "_trigger", Scheduler.class.getName())); | |||
if (oldTrigger != null) { | |||
scheduler.deleteJob(jobDetail.getKey()); | |||
scheduler.scheduleJob(jobDetail, triggerBuilder.startAt(oldTrigger.getNextFireTime()).build()); | |||
trigger = triggerBuilder.startAt(oldTrigger.getNextFireTime()).build(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
Fixes #24931