activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cshan...@apache.org
Subject activemq git commit: https://issues.apache.org/jira/browse/AMQ-6352
Date Tue, 12 Jul 2016 14:28:08 GMT
Repository: activemq
Updated Branches:
  refs/heads/master 0706fd0bc -> d635a3694


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

Fixing PList size tracking by moving the null assignment on removal to
after the onRemoval method is called to make sure that the decrement is
done properly.


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

Branch: refs/heads/master
Commit: d635a369404db25e1c450283a224ed89abf3c5a7
Parents: 0706fd0
Author: Christopher L. Shannon (cshannon) <christopher.l.shannon@gmail.com>
Authored: Tue Jul 12 10:26:58 2016 -0400
Committer: Christopher L. Shannon (cshannon) <christopher.l.shannon@gmail.com>
Committed: Tue Jul 12 10:27:57 2016 -0400

----------------------------------------------------------------------
 .../broker/region/cursors/FilePendingMessageCursor.java        | 2 +-
 .../org/apache/activemq/store/kahadb/disk/index/ListNode.java  | 4 +++-
 .../java/org/apache/activemq/store/kahadb/plist/PListTest.java | 6 ++++++
 3 files changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/d635a369/activemq-broker/src/main/java/org/apache/activemq/broker/region/cursors/FilePendingMessageCursor.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/region/cursors/FilePendingMessageCursor.java
b/activemq-broker/src/main/java/org/apache/activemq/broker/region/cursors/FilePendingMessageCursor.java
index 3c2bd5f..5bd0cda 100755
--- a/activemq-broker/src/main/java/org/apache/activemq/broker/region/cursors/FilePendingMessageCursor.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/broker/region/cursors/FilePendingMessageCursor.java
@@ -358,7 +358,7 @@ public class FilePendingMessageCursor extends AbstractPendingMessageCursor
imple
 
     @Override
     public synchronized long messageSize() {
-        return memoryList.messageSize() + (isDiskListEmpty() ? 0 : (int)getDiskList().messageSize());
+        return memoryList.messageSize() + (isDiskListEmpty() ? 0 : getDiskList().messageSize());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/activemq/blob/d635a369/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/index/ListNode.java
----------------------------------------------------------------------
diff --git a/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/index/ListNode.java
b/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/index/ListNode.java
index 8fed042..9efcd25 100644
--- a/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/index/ListNode.java
+++ b/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/index/ListNode.java
@@ -203,7 +203,7 @@ public final class ListNode<Key, Value> {
             }
             try {
                 entryToRemove.unlink();
-                entryToRemove = null;
+
                 ListNode<Key, Value> toRemoveNode = null;
                 if (currentNode.entries.isEmpty()) {
                     // may need to free this node
@@ -237,7 +237,9 @@ public final class ListNode<Key, Value> {
                         currentNode = previousNode;
                     }
                 }
+
                 targetList.onRemove(entryToRemove);
+                entryToRemove = null;
 
                 if (toRemoveNode != null) {
                     tx.free(toRemoveNode.getPage());

http://git-wip-us.apache.org/repos/asf/activemq/blob/d635a369/activemq-unit-tests/src/test/java/org/apache/activemq/store/kahadb/plist/PListTest.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/store/kahadb/plist/PListTest.java
b/activemq-unit-tests/src/test/java/org/apache/activemq/store/kahadb/plist/PListTest.java
index 555503e..1c33f1a 100644
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/store/kahadb/plist/PListTest.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/store/kahadb/plist/PListTest.java
@@ -32,6 +32,7 @@ import java.util.concurrent.Executors;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.activemq.store.PList;
+import org.apache.activemq.store.PList.PListIterator;
 import org.apache.activemq.store.PListEntry;
 import org.apache.activemq.util.ByteSequence;
 import org.apache.activemq.util.IOHelper;
@@ -74,6 +75,7 @@ public class PListTest {
             plist.addLast(test, bs);
         }
         assertEquals(plist.size(), COUNT);
+        assertTrue(plist.messageSize() > 0);
         int count = 0;
         for (ByteSequence bs : map.values()) {
             String origStr = new String(bs.getData(), bs.getOffset(), bs.getLength());
@@ -95,6 +97,7 @@ public class PListTest {
             plist.addFirst(test, bs);
         }
         assertEquals(plist.size(), COUNT);
+        assertTrue(plist.messageSize() > 0);
         long count = plist.size() - 1;
         for (ByteSequence bs : map.values()) {
             String origStr = new String(bs.getData(), bs.getOffset(), bs.getLength());
@@ -125,6 +128,7 @@ public class PListTest {
             entry = plist.getFirst();
         }
         assertEquals(0, plist.size());
+        assertEquals(0, plist.messageSize());
     }
 
     @Test
@@ -132,6 +136,7 @@ public class PListTest {
         doTestRemove(1);
         plist.destroy();
         assertEquals(0, plist.size());
+        assertEquals(0, plist.messageSize());
     }
 
     @Test
@@ -146,6 +151,7 @@ public class PListTest {
         }
         plist.destroy();
         assertEquals(0, plist.size());
+        assertEquals(0, plist.messageSize());
     }
 
     @Test


Mime
View raw message