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 2009/04/11 00:09:50 UTC

svn commit: r764078 - /qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/transactionlog/BaseTransactionLog.java

Author: ritchiem
Date: Fri Apr 10 22:09:50 2009
New Revision: 764078

URL: http://svn.apache.org/viewvc?rev=764078&view=rev
Log:
QPID-1794 : Moved processing of single message removals to just before the transaction commit rather than before the dequeue. As previously the list of dequeues was being traversed for every dequeue in that transaction batch with nothing to do. So removing this loop should increase performance in large batch cases.

Modified:
    qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/transactionlog/BaseTransactionLog.java

Modified: qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/transactionlog/BaseTransactionLog.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/transactionlog/BaseTransactionLog.java?rev=764078&r1=764077&r2=764078&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/transactionlog/BaseTransactionLog.java (original)
+++ qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/transactionlog/BaseTransactionLog.java Fri Apr 10 22:09:50 2009
@@ -114,36 +114,6 @@
     {
         context.dequeueMessage(queue, messageId);
 
-        if (context.inTransaction())
-        {
-
-            Map<Long, List<AMQQueue>> messageMap = context.getDequeueMap();
-
-            //For each Message ID that is in the map check
-            Set<Long> messageIDs = messageMap.keySet();
-
-            if (_logger.isInfoEnabled())
-            {
-                _logger.info("Pre-Processing single dequeue of:" + messageIDs);
-            }
-
-            Iterator iterator = messageIDs.iterator();
-
-            while (iterator.hasNext())
-            {
-                Long messageID = (Long) iterator.next();
-                //If we don't have a gloabl reference for this message then there is only a single enqueue
-                //can check here to see if this is the last reference?
-                if (_idToQueues.get(messageID) == null)
-                {
-                    // Add the removal of the message to this transaction
-                    _delegate.removeMessage(context, messageID);
-                    // Remove this message ID as we have processed it so we don't reprocess after the main commmit
-                    iterator.remove();
-                }
-            }
-        }
-
         _delegate.dequeueMessage(context, queue, messageId);
 
         if (!context.inTransaction())
@@ -172,6 +142,35 @@
 
     public void commitTran(StoreContext context) throws AMQException
     {
+
+        Map<Long, List<AMQQueue>> messageMap = context.getDequeueMap();
+
+        //For each Message ID that is in the map check
+        Set<Long> messageIDs = messageMap.keySet();
+
+        if (_logger.isInfoEnabled())
+        {
+            _logger.info("Pre-Processing single dequeue of:" + messageIDs);
+        }
+
+        Iterator iterator = messageIDs.iterator();
+
+        while (iterator.hasNext())
+        {
+            Long messageID = (Long) iterator.next();
+            //If we don't have a gloabl reference for this message then there
+            // is only a single enqueue can check here to see if this is the
+            // last reference?
+            if (_idToQueues.get(messageID) == null)
+            {
+                // Add the removal of the message to this transaction
+                _delegate.removeMessage(context, messageID);
+                // Remove this message ID as we have processed it so we don't
+                // reprocess after the main commmit
+                iterator.remove();
+            }
+        }
+
         //Perform real commit of current data
         _delegate.commitTran(context);
 



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