activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hadr...@apache.org
Subject [21/25] git commit: https://issues.apache.org/jira/browse/AMQ-4988
Date Thu, 20 Mar 2014 15:59:16 GMT
https://issues.apache.org/jira/browse/AMQ-4988


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

Branch: refs/heads/activemq-5.9
Commit: 99b8e884bd42e30b97007be5960fd88ed63ac201
Parents: 59bb8a6
Author: Timothy Bish <tabish121@gmai.com>
Authored: Wed Jan 22 10:09:38 2014 -0500
Committer: Hadrian Zbarcea <hadrian@apache.org>
Committed: Thu Mar 20 11:34:23 2014 -0400

----------------------------------------------------------------------
 .../kahadb/scheduler/JobSchedulerImpl.java      | 22 +++++++++-----------
 .../broker/scheduler/JobSchedulerTest.java      |  1 +
 2 files changed, 11 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/99b8e884/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/scheduler/JobSchedulerImpl.java
----------------------------------------------------------------------
diff --git a/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/scheduler/JobSchedulerImpl.java
b/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/scheduler/JobSchedulerImpl.java
index 415a292..455801a 100644
--- a/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/scheduler/JobSchedulerImpl.java
+++ b/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/scheduler/JobSchedulerImpl.java
@@ -435,17 +435,16 @@ class JobSchedulerImpl extends ServiceSupport implements Runnable, JobScheduler
         for (Iterator<Map.Entry<Long, List<JobLocation>>> i = this.index.iterator(tx);
i.hasNext();) {
             Map.Entry<Long, List<JobLocation>> entry = i.next();
             keys.add(entry.getKey());
-            List<JobLocation> values = entry.getValue();
+        }
+
+        for (Long l : keys) {
+            List<JobLocation> values = this.index.remove(tx, l);
             if (values != null) {
                 for (JobLocation jl : values) {
                     this.store.decrementJournalCount(tx, jl.getLocation());
                 }
             }
         }
-
-        for (Long l : keys) {
-            this.index.remove(tx, l);
-        }
     }
 
     synchronized void destroy(Transaction tx, long start, long finish) throws IOException
{
@@ -454,19 +453,18 @@ class JobSchedulerImpl extends ServiceSupport implements Runnable, JobScheduler
             Map.Entry<Long, List<JobLocation>> entry = i.next();
             if (entry.getKey().longValue() <= finish) {
                 keys.add(entry.getKey());
-                List<JobLocation> values = entry.getValue();
-                if (values != null) {
-                    for (JobLocation jl : values) {
-                        this.store.decrementJournalCount(tx, jl.getLocation());
-                    }
-                }
             } else {
                 break;
             }
         }
 
         for (Long l : keys) {
-            this.index.remove(tx, l);
+            List<JobLocation> values = this.index.remove(tx, l);
+            if (values != null) {
+                for (JobLocation jl : values) {
+                    this.store.decrementJournalCount(tx, jl.getLocation());
+                }
+            }
         }
     }
 

http://git-wip-us.apache.org/repos/asf/activemq/blob/99b8e884/activemq-unit-tests/src/test/java/org/apache/activemq/broker/scheduler/JobSchedulerTest.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/scheduler/JobSchedulerTest.java
b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/scheduler/JobSchedulerTest.java
index 65edb08..5126970 100644
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/scheduler/JobSchedulerTest.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/scheduler/JobSchedulerTest.java
@@ -252,6 +252,7 @@ public class JobSchedulerTest {
 
     @After
     public void tearDown() throws Exception {
+        scheduler.stopDispatching();
         store.stop();
     }
 }


Mime
View raw message