You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2018/04/11 14:37:54 UTC

[1/2] activemq-artemis git commit: ARTEMIS-1800 - Fix metrics decrement on scheduled message cancel

Repository: activemq-artemis
Updated Branches:
  refs/heads/master fa3e37fdb -> 3384d6790


ARTEMIS-1800 - Fix metrics decrement on scheduled message cancel

The queue metrics were being decremented improperly because on iteration
over the cancelled scheduled messages because the flag for fromMessageReferences was not
set to false. Setting the flag to false skips over the metrics update
which is what we want as the scheduled messages were never added to the
message references in the first place so the metrics don't need updating


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

Branch: refs/heads/master
Commit: 70f0908b4ee64e68059a21009db9dd3236c26732
Parents: fa3e37f
Author: Christopher L. Shannon (cshannon) <ch...@gmail.com>
Authored: Tue Apr 10 15:54:29 2018 -0400
Committer: Christopher L. Shannon (cshannon) <ch...@gmail.com>
Committed: Tue Apr 10 15:54:29 2018 -0400

----------------------------------------------------------------------
 .../artemis/core/server/impl/QueueImpl.java     |  2 +-
 .../management/QueueControlTest.java            | 33 ++++++++++++++++++++
 2 files changed, 34 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/70f0908b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java
index 0d018dc..5937491 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java
@@ -1546,7 +1546,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue {
 
          List<MessageReference> cancelled = scheduledDeliveryHandler.cancel(filter1);
          for (MessageReference messageReference : cancelled) {
-            messageAction.actMessage(tx, messageReference);
+            messageAction.actMessage(tx, messageReference, false);
             count++;
             txCount++;
          }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/70f0908b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/QueueControlTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/QueueControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/QueueControlTest.java
index 8bd5d03..5a49e2a 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/QueueControlTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/QueueControlTest.java
@@ -2510,6 +2510,39 @@ public class QueueControlTest extends ManagementTestBase {
       Assert.assertEquals(new String(body), "theBody");
    }
 
+   @Test
+   public void testGetScheduledCountOnRemove() throws Exception {
+      long delay = Integer.MAX_VALUE;
+      SimpleString address = RandomUtil.randomSimpleString();
+      SimpleString queue = RandomUtil.randomSimpleString();
+
+      session.createQueue(address, RoutingType.MULTICAST, queue, null, durable);
+
+      QueueControl queueControl = createManagementControl(address, queue);
+      Assert.assertEquals(0, queueControl.getScheduledCount());
+
+      Field queueMemorySizeField = QueueImpl.class.getDeclaredField("queueMemorySize");
+      queueMemorySizeField.setAccessible(true);
+      final LocalQueueBinding binding = (LocalQueueBinding) server.getPostOffice().getBinding(queue);
+      Queue q = binding.getQueue();
+      AtomicInteger queueMemorySize1 = (AtomicInteger) queueMemorySizeField.get(q);
+      assertTrue(queueMemorySize1.get() == 0);
+
+      ClientProducer producer = session.createProducer(address);
+      ClientMessage message = session.createMessage(durable);
+      message.putLongProperty(Message.HDR_SCHEDULED_DELIVERY_TIME, System.currentTimeMillis() + delay);
+      producer.send(message);
+
+      queueControl.removeAllMessages();
+
+      Assert.assertEquals(0, queueControl.getMessageCount());
+
+      //Verify that original queue has a memory size of 0
+      assertTrue(queueMemorySize1.get() == 0);
+
+      session.deleteQueue(queue);
+   }
+
    // Package protected ---------------------------------------------
 
    // Protected -----------------------------------------------------


[2/2] activemq-artemis git commit: This closes #2009

Posted by cl...@apache.org.
This closes #2009


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

Branch: refs/heads/master
Commit: 3384d6790ea691a6c25942fb281f21d927582c72
Parents: fa3e37f 70f0908
Author: Clebert Suconic <cl...@apache.org>
Authored: Wed Apr 11 10:37:47 2018 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Wed Apr 11 10:37:47 2018 -0400

----------------------------------------------------------------------
 .../artemis/core/server/impl/QueueImpl.java     |  2 +-
 .../management/QueueControlTest.java            | 33 ++++++++++++++++++++
 2 files changed, 34 insertions(+), 1 deletion(-)
----------------------------------------------------------------------