summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/broker/Exchange.cpp
diff options
context:
space:
mode:
authorCarl C. Trieloff <cctrieloff@apache.org>2008-10-14 15:23:51 +0000
committerCarl C. Trieloff <cctrieloff@apache.org>2008-10-14 15:23:51 +0000
commit8ec6597d5372ccebb689483b8074085f278022e1 (patch)
tree68b91ab7b9e8a5634e62d280c78c0b6ca86a4554 /cpp/src/qpid/broker/Exchange.cpp
parentba097be388e65acbefa29b2b421a86b57e7554c2 (diff)
downloadqpid-python-8ec6597d5372ccebb689483b8074085f278022e1.tar.gz
Correction of lock scope to make sure ordering from exchange to queue is
preseved when sequencing is used. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@704565 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/broker/Exchange.cpp')
-rw-r--r--cpp/src/qpid/broker/Exchange.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/cpp/src/qpid/broker/Exchange.cpp b/cpp/src/qpid/broker/Exchange.cpp
index deb8df3fc4..a3130d9edb 100644
--- a/cpp/src/qpid/broker/Exchange.cpp
+++ b/cpp/src/qpid/broker/Exchange.cpp
@@ -41,6 +41,20 @@ const std::string qpidMsgSequence("qpid.msg_sequence");
}
+Exchange::PreRoute::PreRoute(Deliverable& msg, Exchange* _p):parent(_p) {
+ if (parent && parent->sequence){
+ parent->sequenceLock.lock();
+ parent->sequenceNo++;
+ msg.getMessage().getProperties<MessageProperties>()->getApplicationHeaders().setInt64(qpidMsgSequence,parent->sequenceNo);
+ }
+}
+
+Exchange::PreRoute::~PreRoute(){
+ if (parent && parent->sequence){
+ parent->sequenceLock.unlock();
+ }
+}
+
Exchange::Exchange (const string& _name, Manageable* parent) :
name(_name), durable(false), persistenceId(0), sequence(false),
sequenceNo(0), mgmtExchange(0)
@@ -89,13 +103,6 @@ Exchange::~Exchange ()
mgmtExchange->resourceDestroy ();
}
-void Exchange::preRoute(Deliverable& msg){
- if (sequence){
- sys::Mutex::ScopedLock lock(sequenceLock);
- msg.getMessage().getProperties<MessageProperties>()->getApplicationHeaders().setInt64(qpidMsgSequence,++sequenceNo);
- }
-}
-
void Exchange::setPersistenceId(uint64_t id) const
{
if (mgmtExchange != 0 && persistenceId == 0)