Author: chug
Date: Thu Mar 28 18:46:50 2013
New Revision: 1462254
URL: http://svn.apache.org/r1462254
Log:
QPID-4672: XmlExchange unbind deadlock - merge fix from trunk to 0.22 branch.
Modified:
qpid/branches/0.22/qpid/cpp/src/qpid/xml/XmlExchange.cpp
qpid/branches/0.22/qpid/cpp/src/qpid/xml/XmlExchange.h
Modified: qpid/branches/0.22/qpid/cpp/src/qpid/xml/XmlExchange.cpp
URL:
http://svn.apache.org/viewvc/qpid/branches/0.22/qpid/cpp/src/qpid/xml/XmlExchange.cpp?rev=1462254&r1=1462253&r2=1462254&view=diff
==============================================================================
--- qpid/branches/0.22/qpid/cpp/src/qpid/xml/XmlExchange.cpp (original)
+++ qpid/branches/0.22/qpid/cpp/src/qpid/xml/XmlExchange.cpp Thu Mar 28
18:46:50 2013
@@ -179,17 +179,24 @@ bool XmlExchange::bind(Queue::shared_ptr
bool XmlExchange::unbind(Queue::shared_ptr queue, const std::string&
bindingKey, const FieldTable* args)
{
+ RWlock::ScopedWlock l(lock);
+ return unbindLH(queue, bindingKey, args);
+}
+
+bool XmlExchange::unbindLH(Queue::shared_ptr queue, const std::string&
bindingKey, const FieldTable* args)
+{
/*
* When called directly, no qpidFedOrigin argument will be
* present. When called from federation, it will be present.
*
* This is a bit of a hack - the binding needs the origin, but
* this interface, as originally defined, would not supply one.
+ *
+ * Note: caller must hold Wlock
*/
std::string fedOrigin;
if (args) fedOrigin = args->getAsString(qpidFedOrigin);
- RWlock::ScopedWlock l(lock);
if (bindingsMap[bindingKey].remove_if(MatchQueueAndOrigin(queue,
fedOrigin))) {
if (mgmtExchange != 0) {
mgmtExchange->dec_bindingCount();
@@ -389,9 +396,9 @@ void XmlExchange::propagateFedOp(const s
bool XmlExchange::fedUnbind(const std::string& fedOrigin, const std::string&
fedTags, Queue::shared_ptr queue, const std::string& bindingKey, const
FieldTable* args)
{
- RWlock::ScopedRlock l(lock);
+ RWlock::ScopedWlock l(lock);
- if (unbind(queue, bindingKey, args)) {
+ if (unbindLH(queue, bindingKey, args)) {
propagateFedOp(bindingKey, fedTags, fedOpUnbind, fedOrigin);
return true;
}
Modified: qpid/branches/0.22/qpid/cpp/src/qpid/xml/XmlExchange.h
URL:
http://svn.apache.org/viewvc/qpid/branches/0.22/qpid/cpp/src/qpid/xml/XmlExchange.h?rev=1462254&r1=1462253&r2=1462254&view=diff
==============================================================================
--- qpid/branches/0.22/qpid/cpp/src/qpid/xml/XmlExchange.h (original)
+++ qpid/branches/0.22/qpid/cpp/src/qpid/xml/XmlExchange.h Thu Mar 28 18:46:50
2013
@@ -107,6 +107,8 @@ class XmlExchange : public virtual Excha
bool operator()(XmlBinding::shared_ptr b);
};
+ private:
+ bool unbindLH(Queue::shared_ptr queue, const std::string& routingKey,
const qpid::framing::FieldTable* args);
};
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]