You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ri...@apache.org on 2007/09/15 00:49:32 UTC

svn commit: r575811 - in /incubator/qpid/branches/M2.1/java: broker/src/main/java/org/apache/qpid/server/queue/SubscriptionImpl.java systests/src/main/java/org/apache/qpid/server/queue/AckTest.java

Author: ritchiem
Date: Fri Sep 14 15:47:52 2007
New Revision: 575811

URL: http://svn.apache.org/viewvc?rev=575811&view=rev
Log:
QPID-573 : 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

Modified:
    incubator/qpid/branches/M2.1/java/broker/src/main/java/org/apache/qpid/server/queue/SubscriptionImpl.java
    incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/server/queue/AckTest.java

Modified: incubator/qpid/branches/M2.1/java/broker/src/main/java/org/apache/qpid/server/queue/SubscriptionImpl.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/java/broker/src/main/java/org/apache/qpid/server/queue/SubscriptionImpl.java?rev=575811&r1=575810&r2=575811&view=diff
==============================================================================
--- incubator/qpid/branches/M2.1/java/broker/src/main/java/org/apache/qpid/server/queue/SubscriptionImpl.java (original)
+++ incubator/qpid/branches/M2.1/java/broker/src/main/java/org/apache/qpid/server/queue/SubscriptionImpl.java Fri Sep 14 15:47:52 2007
@@ -307,7 +307,12 @@
                 }
 
                 protocolSession.getProtocolOutputConverter().writeDeliver(msg, channel.getChannelId(), deliveryTag, consumerTag);
-
+				
+                if (!_acks)
+                {
+                    msg.decrementReference(storeContext);
+                }
+				
             }
         }
         finally

Modified: incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/server/queue/AckTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/server/queue/AckTest.java?rev=575811&r1=575810&r2=575811&view=diff
==============================================================================
--- incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/server/queue/AckTest.java (original)
+++ incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/server/queue/AckTest.java Fri Sep 14 15:47:52 2007
@@ -187,6 +187,25 @@
         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);
+
     }
 
     /**