summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRupert Smith <rupertlssmith@apache.org>2007-09-19 13:24:50 +0000
committerRupert Smith <rupertlssmith@apache.org>2007-09-19 13:24:50 +0000
commitad5ed1effe9439c652f33eada11efcf49e109aa6 (patch)
treec3291fbb22aca806461f14ee3e3a0cf55c41a9a4
parente7732fe7ff602bbc18796731be1b43265da01497 (diff)
downloadqpid-python-ad5ed1effe9439c652f33eada11efcf49e109aa6.tar.gz
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
-rw-r--r--java/broker/src/main/java/org/apache/qpid/server/queue/SubscriptionImpl.java7
-rw-r--r--java/systests/src/main/java/org/apache/qpid/server/queue/AckTest.java19
2 files changed, 25 insertions, 1 deletions
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);
+
}
/**