From ad5ed1effe9439c652f33eada11efcf49e109aa6 Mon Sep 17 00:00:00 2001 From: Rupert Smith Date: Wed, 19 Sep 2007 13:24:50 +0000 Subject: Merged revisions 575811 via svnmerge from https://svn.apache.org/repos/asf/incubator/qpid/branches/M2.1 ........ r575811 | ritchiem | 2007-09-14 23:47:52 +0100 (Fri, 14 Sep 2007) | 1 line QPID-531 : NO_ACK fix. Added a decrementReference in SubscriptionImpl after the message has been sent. This was previously done inside dequeueMessage() but when the reference counting was reworked earlier in the year it was moved out of that method.. but all the uses of dequeueMessage were not evaluated. The existing AckTest didon't detect this error as it only occurs with persistent messages which the client sends by default. The AckTest however only tests transient messages. Updated Test for NO_ACK raised JIRA QPID-602 to cover updating the rest of the AckTests ........ git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/M2.0.0.0_patch@577300 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/qpid/server/queue/SubscriptionImpl.java | 7 ++++++- .../java/org/apache/qpid/server/queue/AckTest.java | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/java/broker/src/main/java/org/apache/qpid/server/queue/SubscriptionImpl.java b/java/broker/src/main/java/org/apache/qpid/server/queue/SubscriptionImpl.java index a7be9f2ad2..774f6e915c 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/queue/SubscriptionImpl.java +++ b/java/broker/src/main/java/org/apache/qpid/server/queue/SubscriptionImpl.java @@ -307,7 +307,12 @@ public class SubscriptionImpl implements Subscription } protocolSession.getProtocolOutputConverter().writeDeliver(msg, channel.getChannelId(), deliveryTag, consumerTag); - + + if (!_acks) + { + msg.decrementReference(storeContext); + } + } } finally diff --git a/java/systests/src/main/java/org/apache/qpid/server/queue/AckTest.java b/java/systests/src/main/java/org/apache/qpid/server/queue/AckTest.java index ae2209c629..be788a02da 100644 --- a/java/systests/src/main/java/org/apache/qpid/server/queue/AckTest.java +++ b/java/systests/src/main/java/org/apache/qpid/server/queue/AckTest.java @@ -187,6 +187,25 @@ public class AckTest extends TestCase UnacknowledgedMessageMap map = _channel.getUnacknowledgedMessageMap(); assertTrue(map.size() == 0); assertTrue(_messageStore.getMessageMetaDataMap().size() == 0); + assertTrue(_messageStore.getContentBodyMap().size() == 0); + + } + + /** + * Tests that in no-ack mode no messages are retained + */ + public void testPersistentNoAckMode() throws AMQException + { + // false arg means no acks expected + _subscription = new SubscriptionImpl(5, _protocolSession, DEFAULT_CONSUMER_TAG, false); + final int msgCount = 10; + publishMessages(msgCount, true); + + UnacknowledgedMessageMap map = _channel.getUnacknowledgedMessageMap(); + assertTrue(map.size() == 0); + assertTrue(_messageStore.getMessageMetaDataMap().size() == 0); + assertTrue(_messageStore.getContentBodyMap().size() == 0); + } /** -- cgit v1.2.1