You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2022/04/12 07:52:31 UTC
[camel] branch main updated: CAMEL-17940: fix the unscheduleTask method to check deleteJob property and isJobStoreClustered (#7416)
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new f97b258ea30 CAMEL-17940: fix the unscheduleTask method to check deleteJob property and isJobStoreClustered (#7416)
f97b258ea30 is described below
commit f97b258ea30f29707adb7836a03f250a84bb9ac5
Author: Michele Blasi <ts...@gmail.com>
AuthorDate: Tue Apr 12 09:52:25 2022 +0200
CAMEL-17940: fix the unscheduleTask method to check deleteJob property and isJobStoreClustered (#7416)
---
.../QuartzScheduledPollConsumerScheduler.java | 24 ++++++++++++----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/components/camel-quartz/src/main/java/org/apache/camel/pollconsumer/quartz/QuartzScheduledPollConsumerScheduler.java b/components/camel-quartz/src/main/java/org/apache/camel/pollconsumer/quartz/QuartzScheduledPollConsumerScheduler.java
index c5bfaf31c3c..f6dd1f09527 100644
--- a/components/camel-quartz/src/main/java/org/apache/camel/pollconsumer/quartz/QuartzScheduledPollConsumerScheduler.java
+++ b/components/camel-quartz/src/main/java/org/apache/camel/pollconsumer/quartz/QuartzScheduledPollConsumerScheduler.java
@@ -90,13 +90,11 @@ public class QuartzScheduledPollConsumerScheduler extends ServiceSupport
@Override
public void unscheduleTask() {
- if (trigger != null) {
- LOG.debug("Unscheduling trigger: {}", trigger.getKey());
- try {
- quartzScheduler.unscheduleJob(trigger.getKey());
- } catch (SchedulerException e) {
- throw RuntimeCamelException.wrapRuntimeCamelException(e);
- }
+ LOG.debug("Unscheduling trigger: {}", trigger.getKey());
+ try {
+ unscheduleJob();
+ } catch (SchedulerException e) {
+ throw RuntimeCamelException.wrapRuntimeCamelException(e);
}
}
@@ -300,6 +298,14 @@ public class QuartzScheduledPollConsumerScheduler extends ServiceSupport
@Override
protected void doStop() throws Exception {
+ unscheduleJob();
+ }
+
+ @Override
+ protected void doShutdown() throws Exception {
+ }
+
+ private void unscheduleJob() throws SchedulerException {
if (trigger != null && deleteJob) {
boolean isClustered = quartzScheduler.getMetaData().isJobStoreClustered();
if (!quartzScheduler.isShutdown() && !isClustered) {
@@ -309,10 +315,6 @@ public class QuartzScheduledPollConsumerScheduler extends ServiceSupport
}
}
- @Override
- protected void doShutdown() throws Exception {
- }
-
private void checkTriggerIsNonConflicting(Trigger trigger) {
JobDataMap jobDataMap = trigger.getJobDataMap();
String routeIdFromTrigger = jobDataMap.getString("routeId");