summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorMartin Ritchie <ritchiem@apache.org>2007-09-14 22:47:52 +0000
committerMartin Ritchie <ritchiem@apache.org>2007-09-14 22:47:52 +0000
commite153353681ef7b4960aba09dcbffb61a99f25f7b (patch)
tree974e4f852d8a6ddfb5282004da0186b96ef2fa64 /java
parent97a264479653731473dc6ae3389458357c876ff5 (diff)
downloadqpid-python-e153353681ef7b4960aba09dcbffb61a99f25f7b.tar.gz
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
(Updated log to show correct JIRA QPID-531 not QPID-573) git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/M2.1@575811 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java')
-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);
+
}
/**