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

Avoid NPE when scheduled method identity has been renamed #25407

Merged
merged 1 commit into from
May 6, 2022

Conversation

machi1990
Copy link
Member

Fixes #24931

@machi1990 machi1990 requested a review from mkouba May 5, 2022 21:30
@@ -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();
Copy link
Member Author

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

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();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@mkouba mkouba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@mkouba mkouba merged commit 4271d53 into quarkusio:main May 6, 2022
@quarkus-bot quarkus-bot bot added this to the 2.10 - main milestone May 6, 2022
@machi1990 machi1990 deleted the fix/24931 branch May 6, 2022 06:54
@gsmet gsmet modified the milestones: 2.10 - main, 2.9.1.Final May 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NullPointerException with Quartz and Quarkus 2.8.0.Final when a job identity is changed
3 participants