camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [1/2] camel git commit: CAMEL-7809: Ensure the cron schedule is updated when the job is rescheduled
Date Tue, 28 Mar 2017 09:38:27 GMT
Repository: camel
Updated Branches:
  refs/heads/camel-2.18.x b40f69f2a -> 711b04817
  refs/heads/master 6a15b8e62 -> 6ab37afa1


CAMEL-7809: Ensure the cron schedule is updated when the job is rescheduled


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/711b0481
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/711b0481
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/711b0481

Branch: refs/heads/camel-2.18.x
Commit: 711b04817e9827da62ab8a005efe4639b117a135
Parents: b40f69f
Author: David Riseley <dave@openanswers.co.uk>
Authored: Tue Mar 28 09:52:53 2017 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Tue Mar 28 11:28:03 2017 +0200

----------------------------------------------------------------------
 .../quartz2/QuartzScheduledPollConsumerScheduler.java       | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/711b0481/components/camel-quartz2/src/main/java/org/apache/camel/pollconsumer/quartz2/QuartzScheduledPollConsumerScheduler.java
----------------------------------------------------------------------
diff --git a/components/camel-quartz2/src/main/java/org/apache/camel/pollconsumer/quartz2/QuartzScheduledPollConsumerScheduler.java
b/components/camel-quartz2/src/main/java/org/apache/camel/pollconsumer/quartz2/QuartzScheduledPollConsumerScheduler.java
index 5192a56..6213903 100644
--- a/components/camel-quartz2/src/main/java/org/apache/camel/pollconsumer/quartz2/QuartzScheduledPollConsumerScheduler.java
+++ b/components/camel-quartz2/src/main/java/org/apache/camel/pollconsumer/quartz2/QuartzScheduledPollConsumerScheduler.java
@@ -168,11 +168,11 @@ public class QuartzScheduledPollConsumerScheduler extends ServiceSupport
impleme
             id = "trigger-" + getCamelContext().getUuidGenerator().generateUuid();
         }
 
-        Trigger existingTrigger = null;
+        CronTrigger existingTrigger = null;
         TriggerKey triggerKey = null;
         if (triggerId != null && triggerGroup != null) {
             triggerKey = new TriggerKey(triggerId, triggerGroup);
-            existingTrigger = quartzScheduler.getTrigger(triggerKey);
+            existingTrigger = (CronTrigger)quartzScheduler.getTrigger(triggerKey);
         }
 
         // Is an trigger already exist for this triggerId ?
@@ -208,8 +208,11 @@ public class QuartzScheduledPollConsumerScheduler extends ServiceSupport
impleme
 
             QuartzHelper.updateJobDataMap(getCamelContext(), job, null);
             LOG.debug("Updated jobData map to {}", jobData);
+            
+            // Ensure the cron schedule is updated
+            CronTrigger newTrigger = existingTrigger.getTriggerBuilder().withSchedule(CronScheduleBuilder.cronSchedule(getCron()).inTimeZone(getTimeZone())).build();
 
-            quartzScheduler.rescheduleJob(triggerKey, existingTrigger);
+            quartzScheduler.rescheduleJob(triggerKey, newTrigger);
         }
     }
 


Mime
View raw message