camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject [2/2] git commit: CAMEL-7033 take clustering into consideration when stop the consumer with thanks Arne
Date Thu, 03 Apr 2014 10:02:38 GMT
CAMEL-7033 take clustering into consideration when stop the consumer with thanks Arne


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

Branch: refs/heads/camel-2.12.x
Commit: c65737bdf2892f3086577f7ee802b85afad49016
Parents: 3910e19
Author: Willem Jiang <willem.jiang@gmail.com>
Authored: Thu Apr 3 17:26:25 2014 +0800
Committer: Willem Jiang <willem.jiang@gmail.com>
Committed: Thu Apr 3 18:02:07 2014 +0800

----------------------------------------------------------------------
 .../camel/component/quartz2/QuartzEndpoint.java | 22 ++++++++------------
 1 file changed, 9 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/c65737bd/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/QuartzEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/QuartzEndpoint.java
b/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/QuartzEndpoint.java
index 94a2077..1aeb9d0 100644
--- a/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/QuartzEndpoint.java
+++ b/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/QuartzEndpoint.java
@@ -66,8 +66,8 @@ public class QuartzEndpoint extends DefaultEndpoint {
     private long triggerStartDelay = 500; // in millis second
 
     // An internal variables to track whether a job has been in scheduler or not, and has
it paused or not.
-    private AtomicBoolean jobAdded = new AtomicBoolean(false);
-    private AtomicBoolean jobPaused = new AtomicBoolean(false);
+    private final AtomicBoolean jobAdded = new AtomicBoolean(false);
+    private final AtomicBoolean jobPaused = new AtomicBoolean(false);
     
     public QuartzEndpoint(String uri, QuartzComponent quartzComponent) {
         super(uri, quartzComponent);
@@ -210,13 +210,7 @@ public class QuartzEndpoint extends DefaultEndpoint {
                 jobAdded.set(false);
             }
         } else if (pauseJob) {
-            boolean isClustered = scheduler.getMetaData().isJobStoreClustered();
-            if (!scheduler.isShutdown() && !isClustered) {
-                LOG.info("Pausing job {}", triggerKey);
-                scheduler.pauseTrigger(triggerKey);
-
-                jobAdded.set(false);
-            }
+            pauseTrigger();
         }
 
         // Decrement camel job count for this endpoint
@@ -374,13 +368,15 @@ public class QuartzEndpoint extends DefaultEndpoint {
     }
 
     public void pauseTrigger() throws Exception {
-        if (jobPaused.get()) {
+        Scheduler scheduler = getComponent().getScheduler();
+        boolean isClustered = scheduler.getMetaData().isJobStoreClustered();
+
+        if (jobPaused.get() || isClustered) {
             return;
         }
+        
         jobPaused.set(true);
-
-        Scheduler scheduler = getComponent().getScheduler();
-        if (scheduler != null && !scheduler.isShutdown()) {
+        if (!scheduler.isShutdown()) {
             LOG.info("Pausing trigger {}", triggerKey);
             scheduler.pauseTrigger(triggerKey);
         }


Mime
View raw message