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:53:11 UTC

[camel] branch camel-3.14.x 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 camel-3.14.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-3.14.x by this push:
     new a7d63d82e2a CAMEL-17940: fix the unscheduleTask method to check deleteJob property and isJobStoreClustered (#7416)
a7d63d82e2a is described below

commit a7d63d82e2a794ef8acef7abce3d9226a52bb700
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");