summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/broker/QueuePolicy.cpp
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2009-06-03 16:08:33 +0000
committerGordon Sim <gsim@apache.org>2009-06-03 16:08:33 +0000
commit298f6aa34e0cd07e0d89016990bd9c21902c811d (patch)
treeff346b5f92291daf26bc06145ce8bb1f1546d96f /cpp/src/qpid/broker/QueuePolicy.cpp
parent12048dcd9d13f1c2baeffb4b65c4ce65c0155234 (diff)
downloadqpid-python-298f6aa34e0cd07e0d89016990bd9c21902c811d.tar.gz
Ensure that ring queue behaves as expected when replicated to newly joined cluster node.
Altered queueDurabilityPropagationToNewbie test to not use in-process broker to fix error caused by linking change. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@781454 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/broker/QueuePolicy.cpp')
-rw-r--r--cpp/src/qpid/broker/QueuePolicy.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/cpp/src/qpid/broker/QueuePolicy.cpp b/cpp/src/qpid/broker/QueuePolicy.cpp
index c59736969f..43d914fc42 100644
--- a/cpp/src/qpid/broker/QueuePolicy.cpp
+++ b/cpp/src/qpid/broker/QueuePolicy.cpp
@@ -187,11 +187,17 @@ bool FlowToDiskPolicy::checkLimit(const QueuedMessage& m)
RingQueuePolicy::RingQueuePolicy(uint32_t _maxCount, uint64_t _maxSize, const std::string& _type) :
QueuePolicy(_maxCount, _maxSize, _type), strict(_type == RING_STRICT) {}
+bool before(const QueuedMessage& a, const QueuedMessage& b)
+{
+ return a.position < b.position;
+}
+
void RingQueuePolicy::enqueued(const QueuedMessage& m)
{
QueuePolicy::enqueued(m);
qpid::sys::Mutex::ScopedLock l(lock);
- queue.push_back(m);
+ //need to insert in correct location based on position
+ queue.insert(lower_bound(queue.begin(), queue.end(), m, before), m);
}
void RingQueuePolicy::dequeued(const QueuedMessage& m)