camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [4/4] git commit: CAMEL-6832: Fixed quartz to only add job counter if scheduling the job was succesful.
Date Sat, 12 Oct 2013 10:18:49 GMT
CAMEL-6832: Fixed quartz to only add job counter if scheduling the job was succesful.


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

Branch: refs/heads/camel-2.10.x
Commit: 013e4058c151fdfab39fe36508bacf0b9d69ab84
Parents: 92bf425
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Sat Oct 12 12:17:22 2013 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Sat Oct 12 12:18:02 2013 +0200

----------------------------------------------------------------------
 .../apache/camel/component/quartz/QuartzComponent.java    | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/013e4058/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzComponent.java
b/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzComponent.java
index 5dcc34a..3db14d5 100644
--- a/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzComponent.java
+++ b/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzComponent.java
@@ -224,8 +224,6 @@ public class QuartzComponent extends DefaultComponent implements StartupListener
     }
 
     private void doAddJob(JobDetail job, Trigger trigger) throws SchedulerException {
-        incrementJobCounter(getScheduler());
-
         Trigger existingTrigger = getScheduler().getTrigger(trigger.getName(), trigger.getGroup());
         if (existingTrigger == null) {
             LOG.debug("Adding job using trigger: {}/{}", trigger.getGroup(), trigger.getName());
@@ -257,6 +255,9 @@ public class QuartzComponent extends DefaultComponent implements StartupListener
                 LOG.debug("Trigger: {}/{} already exists and is already scheduled by clustered
JobStore.", trigger.getGroup(), trigger.getName());
             }
         }
+
+        // only increment job counter if we are successful
+        incrementJobCounter(getScheduler());
     }
 
     private boolean hasTriggerChanged(Trigger oldTrigger, Trigger newTrigger) {
@@ -270,8 +271,6 @@ public class QuartzComponent extends DefaultComponent implements StartupListener
     }
 
     public void pauseJob(Trigger trigger) throws SchedulerException {
-        decrementJobCounter(getScheduler());
-
         if (isClustered()) {
             // do not pause jobs which are clustered, as we want the jobs to continue running
on the other nodes
             LOG.debug("Cannot pause job using trigger: {}/{} as the JobStore is clustered.",
trigger.getGroup(), trigger.getName());
@@ -280,6 +279,9 @@ public class QuartzComponent extends DefaultComponent implements StartupListener
             getScheduler().pauseTrigger(trigger.getName(), trigger.getGroup());
             getScheduler().pauseJob(trigger.getName(), trigger.getGroup());
         }
+
+        // only decrement job counter if we are successful
+        decrementJobCounter(getScheduler());
     }
 
     public void deleteJob(String name, String group) throws SchedulerException {


Mime
View raw message