You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ro...@apache.org on 2011/03/28 11:58:51 UTC

svn commit: r1086169 - /qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/MultipleTransactedBatchProducerTest.java

Author: robbie
Date: Mon Mar 28 09:58:51 2011
New Revision: 1086169

URL: http://svn.apache.org/viewvc?rev=1086169&view=rev
Log:
QPID-3166: updates based on review feedback from Keith Wall

Modified:
    qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/MultipleTransactedBatchProducerTest.java

Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/MultipleTransactedBatchProducerTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/MultipleTransactedBatchProducerTest.java?rev=1086169&r1=1086168&r2=1086169&view=diff
==============================================================================
--- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/MultipleTransactedBatchProducerTest.java (original)
+++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/MultipleTransactedBatchProducerTest.java Mon Mar 28 09:58:51 2011
@@ -34,29 +34,6 @@ import javax.jms.Session;
 import org.apache.log4j.Logger;
 import org.apache.qpid.test.utils.QpidBrokerTestCase;
 
-/**
- * MultipleTransactedBatchProducerTest
- *
- * Summary:
- * When there are multiple producers submitting batches of messages to a given
- * queue using transacted sessions, it is highly probable that concurrent
- * enqueue() activity will occur and attempt delivery of their message to the
- * same subscription. In this scenario it is likely that one of the attempts
- * will succeed and the other will result in use of the deliverAsync() method
- * to start a queue Runner and ensure delivery of the message.
- *
- * A defect within the processQueue() method used by the Runner would mean that
- * delivery of these messages may not occur, should the Runner stop before all
- * messages have been processed. Such a defect was discovered and found to be
- * most visible when Selectors are used such that one and only one subscription
- * can/will accept any given message, but multiple subscriptions are present,
- * and one of the earlier subscriptions receives more messages than the others.
- *
- * This test is to validate that the processQueue() method is able to correctly
- * deliver all of the messages present for asynchronous delivery to subscriptions,
- * by utilising multiple batch transacted producers to create the scenario and
- * ensure all messages are received by a consumer.
- */
 public class MultipleTransactedBatchProducerTest extends QpidBrokerTestCase
 {
     private static final Logger _logger = Logger.getLogger(MultipleTransactedBatchProducerTest.class);
@@ -70,7 +47,7 @@ public class MultipleTransactedBatchProd
     private CountDownLatch _receivedLatch;
     private String _queueName;
 
-    private String _failMsg;
+    private volatile String _failMsg;
 
     public void setUp() throws Exception
     {
@@ -83,6 +60,26 @@ public class MultipleTransactedBatchProd
         _failMsg = null;
     }
 
+    /**
+     * When there are multiple producers submitting batches of messages to a given
+     * queue using transacted sessions, it is highly probable that concurrent
+     * enqueue() activity will occur and attempt delivery of their message to the
+     * same subscription. In this scenario it is likely that one of the attempts
+     * will succeed and the other will result in use of the deliverAsync() method
+     * to start a queue Runner and ensure delivery of the message.
+     *
+     * A defect within the processQueue() method used by the Runner would mean that
+     * delivery of these messages may not occur, should the Runner stop before all
+     * messages have been processed. Such a defect was discovered and found to be
+     * most visible when Selectors are used such that one and only one subscription
+     * can/will accept any given message, but multiple subscriptions are present,
+     * and one of the earlier subscriptions receives more messages than the others.
+     *
+     * This test is to validate that the processQueue() method is able to correctly
+     * deliver all of the messages present for asynchronous delivery to subscriptions,
+     * by utilising multiple batch transacted producers to create the scenario and
+     * ensure all messages are received by a consumer.
+     */
     public void testMultipleBatchedProducersWithMultipleConsumersUsingSelectors() throws Exception
     {
         String selector1 = ("(\"" + _queueName +"\" % " + NUM_CONSUMERS + ") = 0");
@@ -138,7 +135,9 @@ public class MultipleTransactedBatchProd
     {
         Message message = super.createNextMessage(session,msgCount);
 
-        //bias at least 50% of the messages to the first consumers selector
+        //bias at least 50% of the messages to the first consumers selector because
+        //the issue presents itself primarily when an earlier subscription completes
+        //delivery after the later subscriptions
         int val;
         if (msgCount % 2 == 0)
         {



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org