summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/broker/TopicExchange.cpp
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2013-11-12 13:42:36 +0000
committerGordon Sim <gsim@apache.org>2013-11-12 13:42:36 +0000
commit5f3ff3bcc03691d0646cd75d8408be284d8adee6 (patch)
treed475768bd96b23ac17771b1b9d8617b2790d83e5 /cpp/src/qpid/broker/TopicExchange.cpp
parent3741945c58f6b835003bbdb978efa34ff6a681b5 (diff)
downloadqpid-python-5f3ff3bcc03691d0646cd75d8408be284d8adee6.tar.gz
QPID-5301: support autodeleted exchanges
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1541058 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/broker/TopicExchange.cpp')
-rw-r--r--cpp/src/qpid/broker/TopicExchange.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/cpp/src/qpid/broker/TopicExchange.cpp b/cpp/src/qpid/broker/TopicExchange.cpp
index 6a081bf65f..558c900a4f 100644
--- a/cpp/src/qpid/broker/TopicExchange.cpp
+++ b/cpp/src/qpid/broker/TopicExchange.cpp
@@ -147,9 +147,9 @@ TopicExchange::TopicExchange(const string& _name, Manageable* _parent, Broker* b
mgmtExchange->set_type (typeName);
}
-TopicExchange::TopicExchange(const std::string& _name, bool _durable,
+TopicExchange::TopicExchange(const std::string& _name, bool _durable, bool autodelete,
const FieldTable& _args, Manageable* _parent, Broker* b) :
- Exchange(_name, _durable, _args, _parent, b),
+ Exchange(_name, _durable, autodelete, _args, _parent, b),
nBindings(0)
{
if (mgmtExchange != 0)
@@ -241,6 +241,7 @@ bool TopicExchange::unbind(Queue::shared_ptr queue, const string& constRoutingKe
deleteBinding(queue, routingKey, bk);
if (propagate)
propagateFedOp(routingKey, string(), fedOpUnbind, string());
+ if (nBindings == 0) checkAutodelete();
return true;
}
@@ -340,4 +341,10 @@ TopicExchange::~TopicExchange() {
const std::string TopicExchange::typeName("topic");
+bool TopicExchange::hasBindings()
+{
+ RWlock::ScopedRlock l(lock);
+ return nBindings > 0;
+}
+
}} // namespace qpid::broker