diff options
| author | Martin Ritchie <ritchiem@apache.org> | 2009-04-10 22:09:50 +0000 |
|---|---|---|
| committer | Martin Ritchie <ritchiem@apache.org> | 2009-04-10 22:09:50 +0000 |
| commit | 553e8cc73ff51c9850bdb3ddc8c8f4f356738a85 (patch) | |
| tree | d9da88200a8b880ca4eab7fdc62413fbc94f6f76 /qpid/java | |
| parent | 1f48e2409ae3187dd31d093e68d3f6fa8617a0d1 (diff) | |
| download | qpid-python-553e8cc73ff51c9850bdb3ddc8c8f4f356738a85.tar.gz | |
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.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@764078 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java')
| -rw-r--r-- | qpid/java/broker/src/main/java/org/apache/qpid/server/transactionlog/BaseTransactionLog.java | 59 |
1 files changed, 29 insertions, 30 deletions
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/transactionlog/BaseTransactionLog.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/transactionlog/BaseTransactionLog.java index 8d7b22d470..7bf78ad977 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/transactionlog/BaseTransactionLog.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/transactionlog/BaseTransactionLog.java @@ -114,36 +114,6 @@ public class BaseTransactionLog implements TransactionLog { 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 class BaseTransactionLog implements TransactionLog 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); |
