diff options
| author | Ted Ross <tross@apache.org> | 2010-02-12 21:23:27 +0000 |
|---|---|---|
| committer | Ted Ross <tross@apache.org> | 2010-02-12 21:23:27 +0000 |
| commit | 0b4bb5acdba9afef93a99864b39e1de438b5dc42 (patch) | |
| tree | 5582b724a780595e6a33ac959a313c3e0e65048e /cpp/src/qpid/broker | |
| parent | 1827a69f01ea0a955161fd93edfa137d7b1723a4 (diff) | |
| download | qpid-python-0b4bb5acdba9afef93a99864b39e1de438b5dc42.tar.gz | |
Changes needed for QPID-2029 (Clustering and Management don't work well together)
This update changes the indexing of object IDs in the broker-resident management agent
from being based on the QMFv1 format (numeric) to the QMFv2 format (string name). This removes
the need for numeric objectIds to be synchronized across a set of clustered brokers.
Also included in this patch is a fix to a bug in binding creation. Previously, when a binding
was created that already existed, the management object for the proposed binding (duplicate of
the existing one) was created then destroyed. This is inefficient and causes problems when the
name-based indexes collide.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@909610 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/broker')
| -rw-r--r-- | cpp/src/qpid/broker/DirectExchange.cpp | 1 | ||||
| -rw-r--r-- | cpp/src/qpid/broker/Exchange.cpp | 30 | ||||
| -rw-r--r-- | cpp/src/qpid/broker/Exchange.h | 3 | ||||
| -rw-r--r-- | cpp/src/qpid/broker/FanOutExchange.cpp | 1 | ||||
| -rw-r--r-- | cpp/src/qpid/broker/HeadersExchange.cpp | 1 | ||||
| -rw-r--r-- | cpp/src/qpid/broker/TopicExchange.cpp | 1 |
6 files changed, 24 insertions, 13 deletions
diff --git a/cpp/src/qpid/broker/DirectExchange.cpp b/cpp/src/qpid/broker/DirectExchange.cpp index 094f59cdec..05179502e6 100644 --- a/cpp/src/qpid/broker/DirectExchange.cpp +++ b/cpp/src/qpid/broker/DirectExchange.cpp @@ -77,6 +77,7 @@ bool DirectExchange::bind(Queue::shared_ptr queue, const string& routingKey, con if (exclusiveBinding) bk.queues.clear(); if (bk.queues.add_unless(b, MatchQueue(queue))) { + b->startManagement(); propagate = bk.fedBinding.addOrigin(fedOrigin); if (mgmtExchange != 0) { mgmtExchange->inc_bindingCount(); diff --git a/cpp/src/qpid/broker/Exchange.cpp b/cpp/src/qpid/broker/Exchange.cpp index 16eb75c88b..7bb70ed24a 100644 --- a/cpp/src/qpid/broker/Exchange.cpp +++ b/cpp/src/qpid/broker/Exchange.cpp @@ -306,9 +306,23 @@ void Exchange::propagateFedOp(const string& routingKey, const string& tags, cons (*iter)->propagateBinding(routingKey, tags, op, origin, extra_args); } -Exchange::Binding::Binding(const string& _key, Queue::shared_ptr _queue, Exchange* parent, - FieldTable _args, const string& origin) - : queue(_queue), key(_key), args(_args), mgmtBinding(0) +Exchange::Binding::Binding(const string& _key, Queue::shared_ptr _queue, Exchange* _parent, + FieldTable _args, const string& _origin) + : parent(_parent), queue(_queue), key(_key), args(_args), origin(_origin), mgmtBinding(0) +{ +} + +Exchange::Binding::~Binding () +{ + if (mgmtBinding != 0) { + ManagementObject* mo = queue->GetManagementObject(); + if (mo != 0) + static_cast<_qmf::Queue*>(mo)->dec_bindingCount(); + mgmtBinding->resourceDestroy (); + } +} + +void Exchange::Binding::startManagement() { if (parent != 0) { @@ -333,16 +347,6 @@ Exchange::Binding::Binding(const string& _key, Queue::shared_ptr _queue, Exchang } } -Exchange::Binding::~Binding () -{ - if (mgmtBinding != 0) { - ManagementObject* mo = queue->GetManagementObject(); - if (mo != 0) - static_cast<_qmf::Queue*>(mo)->dec_bindingCount(); - mgmtBinding->resourceDestroy (); - } -} - ManagementObject* Exchange::Binding::GetManagementObject () const { return (ManagementObject*) mgmtBinding; diff --git a/cpp/src/qpid/broker/Exchange.h b/cpp/src/qpid/broker/Exchange.h index dfe69e2c04..23d044ffd3 100644 --- a/cpp/src/qpid/broker/Exchange.h +++ b/cpp/src/qpid/broker/Exchange.h @@ -45,14 +45,17 @@ public: typedef boost::shared_ptr<Binding> shared_ptr; typedef std::vector<Binding::shared_ptr> vector; + Exchange* parent; Queue::shared_ptr queue; const std::string key; const framing::FieldTable args; + std::string origin; qmf::org::apache::qpid::broker::Binding* mgmtBinding; Binding(const std::string& key, Queue::shared_ptr queue, Exchange* parent = 0, framing::FieldTable args = framing::FieldTable(), const std::string& origin = std::string()); ~Binding(); + void startManagement(); management::ManagementObject* GetManagementObject() const; }; diff --git a/cpp/src/qpid/broker/FanOutExchange.cpp b/cpp/src/qpid/broker/FanOutExchange.cpp index 6d840b50df..ef410a9154 100644 --- a/cpp/src/qpid/broker/FanOutExchange.cpp +++ b/cpp/src/qpid/broker/FanOutExchange.cpp @@ -63,6 +63,7 @@ bool FanOutExchange::bind(Queue::shared_ptr queue, const string& /*key*/, const if (args == 0 || fedOp.empty() || fedOp == fedOpBind) { Binding::shared_ptr binding (new Binding ("", queue, this, FieldTable(), fedOrigin)); if (bindings.add_unless(binding, MatchQueue(queue))) { + binding->startManagement(); propagate = fedBinding.addOrigin(fedOrigin); if (mgmtExchange != 0) { mgmtExchange->inc_bindingCount(); diff --git a/cpp/src/qpid/broker/HeadersExchange.cpp b/cpp/src/qpid/broker/HeadersExchange.cpp index e4a76a0bcd..640036e741 100644 --- a/cpp/src/qpid/broker/HeadersExchange.cpp +++ b/cpp/src/qpid/broker/HeadersExchange.cpp @@ -114,6 +114,7 @@ bool HeadersExchange::bind(Queue::shared_ptr queue, const string& bindingKey, co Binding::shared_ptr binding (new Binding (bindingKey, queue, this, *args)); BoundKey bk(binding); if (bindings.add_unless(bk, MatchArgs(queue, args))) { + binding->startManagement(); propagate = bk.fedBinding.addOrigin(fedOrigin); if (mgmtExchange != 0) { mgmtExchange->inc_bindingCount(); diff --git a/cpp/src/qpid/broker/TopicExchange.cpp b/cpp/src/qpid/broker/TopicExchange.cpp index dd57549b5d..6e53ef5fd2 100644 --- a/cpp/src/qpid/broker/TopicExchange.cpp +++ b/cpp/src/qpid/broker/TopicExchange.cpp @@ -207,6 +207,7 @@ bool TopicExchange::bind(Queue::shared_ptr queue, const string& routingKey, cons return false; } else { Binding::shared_ptr binding (new Binding (routingPattern, queue, this, FieldTable(), fedOrigin)); + binding->startManagement(); BoundKey& bk = bindings[routingPattern]; bk.bindingVector.push_back(binding); propagate = bk.fedBinding.addOrigin(fedOrigin); |
