activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject [1/2] activemq git commit: https://issues.apache.org/jira/browse/AMQ-6159
Date Thu, 04 Feb 2016 22:18:31 GMT
Repository: activemq
Updated Branches:
  refs/heads/activemq-5.13.x 23e9ecaec -> 4782feb6a
  refs/heads/master 33dded13d -> 386210faf


https://issues.apache.org/jira/browse/AMQ-6159

Ensure proper repeat counts are scheduled.  

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

Branch: refs/heads/master
Commit: 386210fafe331630aded29f2af64b1ccdf161bf3
Parents: 33dded1
Author: Timothy Bish <tabish121@gmail.com>
Authored: Thu Feb 4 17:16:33 2016 -0500
Committer: Timothy Bish <tabish121@gmail.com>
Committed: Thu Feb 4 17:16:58 2016 -0500

----------------------------------------------------------------------
 .../broker/scheduler/memory/InMemoryJobScheduler.java     |  5 +++--
 .../activemq/broker/scheduler/JmsSchedulerTest.java       | 10 ++++++++--
 2 files changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/386210fa/activemq-broker/src/main/java/org/apache/activemq/broker/scheduler/memory/InMemoryJobScheduler.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/scheduler/memory/InMemoryJobScheduler.java
b/activemq-broker/src/main/java/org/apache/activemq/broker/scheduler/memory/InMemoryJobScheduler.java
index 41be322..bd2aaf5 100644
--- a/activemq-broker/src/main/java/org/apache/activemq/broker/scheduler/memory/InMemoryJobScheduler.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/broker/scheduler/memory/InMemoryJobScheduler.java
@@ -273,7 +273,9 @@ public class InMemoryJobScheduler implements JobScheduler {
     private void doReschedule(InMemoryJob job, long nextExecutionTime) {
         job.setNextTime(nextExecutionTime);
         job.incrementExecutionCount();
-        job.decrementRepeatCount();
+        if (!job.isCron()) {
+            job.decrementRepeatCount();
+        }
 
         LOG.trace("JobScheduler rescheduling job[{}] to fire at: {}", job.getJobId(), JobSupport.getDateTime(nextExecutionTime));
 
@@ -291,7 +293,6 @@ public class InMemoryJobScheduler implements JobScheduler {
         } finally {
             lock.writeLock().unlock();
         }
-
     }
 
     private void doRemoveJob(String jobId) throws IOException {

http://git-wip-us.apache.org/repos/asf/activemq/blob/386210fa/activemq-unit-tests/src/test/java/org/apache/activemq/broker/scheduler/JmsSchedulerTest.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/scheduler/JmsSchedulerTest.java
b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/scheduler/JmsSchedulerTest.java
index 0ce584d..d0c1ccc 100644
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/scheduler/JmsSchedulerTest.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/scheduler/JmsSchedulerTest.java
@@ -38,9 +38,13 @@ import org.apache.activemq.ScheduledMessage;
 import org.apache.activemq.util.ProducerThread;
 import org.apache.activemq.util.Wait;
 import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class JmsSchedulerTest extends JobSchedulerTestSupport {
 
+    private static final Logger LOG = LoggerFactory.getLogger(JmsSchedulerTest.class);
+
     @Test
     public void testCron() throws Exception {
         final int COUNT = 10;
@@ -55,8 +59,9 @@ public class JmsSchedulerTest extends JobSchedulerTestSupport {
         consumer.setMessageListener(new MessageListener() {
             @Override
             public void onMessage(Message message) {
-                latch.countDown();
                 count.incrementAndGet();
+                latch.countDown();
+                LOG.info("Received scheduled message, waiting for {} more", latch.getCount());
             }
         });
 
@@ -167,8 +172,9 @@ public class JmsSchedulerTest extends JobSchedulerTestSupport {
         consumer.setMessageListener(new MessageListener() {
             @Override
             public void onMessage(Message message) {
-                latch.countDown();
                 count.incrementAndGet();
+                latch.countDown();
+                LOG.info("Received scheduled message, waiting for {} more", latch.getCount());
             }
         });
 


Mime
View raw message