You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gs...@apache.org on 2013/12/03 18:52:58 UTC
svn commit: r1547496 - in /qpid/trunk/qpid/cpp/src/qpid: broker/Exchange.cpp
broker/Exchange.h broker/amqp/NodeProperties.cpp
broker/amqp/NodeProperties.h messaging/amqp/AddressHelper.cpp
Author: gsim
Date: Tue Dec 3 17:52:57 2013
New Revision: 1547496
URL: http://svn.apache.org/r1547496
Log:
QPID-5384: special asserting logic for autodelete
Modified:
qpid/trunk/qpid/cpp/src/qpid/broker/Exchange.cpp
qpid/trunk/qpid/cpp/src/qpid/broker/Exchange.h
qpid/trunk/qpid/cpp/src/qpid/broker/amqp/NodeProperties.cpp
qpid/trunk/qpid/cpp/src/qpid/broker/amqp/NodeProperties.h
qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/AddressHelper.cpp
Modified: qpid/trunk/qpid/cpp/src/qpid/broker/Exchange.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/Exchange.cpp?rev=1547496&r1=1547495&r2=1547496&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/broker/Exchange.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/Exchange.cpp Tue Dec 3 17:52:57 2013
@@ -485,6 +485,10 @@ bool Exchange::isDestroyed() const
Mutex::ScopedLock l(usersLock);
return destroyed;
}
+bool Exchange::isAutoDelete() const
+{
+ return autodelete;
+}
}}
Modified: qpid/trunk/qpid/cpp/src/qpid/broker/Exchange.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/Exchange.h?rev=1547496&r1=1547495&r2=1547496&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/broker/Exchange.h (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/Exchange.h Tue Dec 3 17:52:57 2013
@@ -180,6 +180,7 @@ public:
const std::string& getName() const { return name; }
bool isDurable() { return durable; }
+ QPID_BROKER_EXTERN bool isAutoDelete() const;
QPID_BROKER_EXTERN const qpid::framing::FieldTable& getArgs() const { return args; }
QPID_BROKER_EXTERN void setArgs(const framing::FieldTable&);
Modified: qpid/trunk/qpid/cpp/src/qpid/broker/amqp/NodeProperties.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/amqp/NodeProperties.cpp?rev=1547496&r1=1547495&r2=1547496&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/broker/amqp/NodeProperties.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/amqp/NodeProperties.cpp Tue Dec 3 17:52:57 2013
@@ -110,6 +110,12 @@ void NodeProperties::read(pn_data_t* dat
{
DataReader reader(*this);
reader.read(data);
+
+}
+
+bool NodeProperties::wasSpecified(const std::string& key)
+{
+ return specified.find(key) != specified.end();
}
void NodeProperties::write(pn_data_t* data, boost::shared_ptr<Queue> node)
@@ -120,7 +126,7 @@ void NodeProperties::write(pn_data_t* da
pn_data_put_symbol(data, convert(SUPPORTED_DIST_MODES));
pn_data_put_string(data, convert(MOVE));//TODO: should really add COPY as well, since queues can be browsed
pn_bytes_t symbol;
- if (autoDelete && node->isAutoDelete() && getLifetimeDescriptorSymbol(node->getSettings().lifetime, symbol)) {
+ if (wasSpecified(AUTO_DELETE) && node->isAutoDelete() && getLifetimeDescriptorSymbol(node->getSettings().lifetime, symbol)) {
pn_data_put_symbol(data, convert(LIFETIME_POLICY));
pn_data_put_described(data);
pn_data_enter(data);
@@ -128,11 +134,11 @@ void NodeProperties::write(pn_data_t* da
pn_data_put_list(data);
pn_data_exit(data);
}
- if (durable && node->isDurable()) {
+ if (wasSpecified(DURABLE) && node->isDurable()) {
pn_data_put_symbol(data, convert(DURABLE));
pn_data_put_bool(data, true);
}
- if (exclusive && node->hasExclusiveOwner()) {
+ if (wasSpecified(EXCLUSIVE) && node->hasExclusiveOwner()) {
pn_data_put_symbol(data, convert(EXCLUSIVE));
pn_data_put_bool(data, true);
}
@@ -170,7 +176,7 @@ void NodeProperties::write(pn_data_t* da
pn_data_enter(data);
pn_data_put_symbol(data, convert(SUPPORTED_DIST_MODES));
pn_data_put_string(data, convert(COPY));
- if (durable && node->isDurable()) {
+ if (wasSpecified(DURABLE) && node->isDurable()) {
pn_data_put_symbol(data, convert(DURABLE));
pn_data_put_bool(data, true);
}
@@ -182,9 +188,9 @@ void NodeProperties::write(pn_data_t* da
pn_data_put_symbol(data, convert(ALTERNATE_EXCHANGE));
pn_data_put_string(data, convert(node->getAlternate()->getName()));
}
- if (autoDelete) {
+ if (wasSpecified(AUTO_DELETE)) {
pn_data_put_symbol(data, convert(AUTO_DELETE));
- pn_data_put_bool(data, autoDelete);
+ pn_data_put_bool(data, node->isAutoDelete());
}
for (qpid::types::Variant::Map::const_iterator i = properties.begin(); i != properties.end(); ++i) {
@@ -203,6 +209,7 @@ void NodeProperties::process(const std::
{
received = true;
QPID_LOG(debug, "Processing node property " << key << " = " << value);
+ specified.insert(key);
if (key == SUPPORTED_DIST_MODES) {
if (value == MOVE) queue = true;
else if (value == COPY) queue = false;
Modified: qpid/trunk/qpid/cpp/src/qpid/broker/amqp/NodeProperties.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/amqp/NodeProperties.h?rev=1547496&r1=1547495&r2=1547496&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/broker/amqp/NodeProperties.h (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/amqp/NodeProperties.h Tue Dec 3 17:52:57 2013
@@ -24,6 +24,7 @@
#include "qpid/amqp/MapReader.h"
#include "qpid/types/Variant.h"
#include "qpid/broker/QueueSettings.h"
+#include <set>
#include <boost/shared_ptr.hpp>
struct pn_data_t;
@@ -77,8 +78,10 @@ class NodeProperties : public qpid::amqp
std::string alternateExchange;
qpid::types::Variant::Map properties;
QueueSettings::LifetimePolicy lifetime;
+ std::set<std::string> specified;
void process(const std::string&, const qpid::types::Variant&, const qpid::amqp::Descriptor*);
+ bool wasSpecified(const std::string& key);
};
}}} // namespace qpid::broker::amqp
Modified: qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/AddressHelper.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/AddressHelper.cpp?rev=1547496&r1=1547495&r2=1547496&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/AddressHelper.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/AddressHelper.cpp Tue Dec 3 17:52:57 2013
@@ -660,6 +660,7 @@ void AddressHelper::checkAssertion(pn_te
//set. However this can be avoided by not specifying any node
//properties when asserting)
if (!type.empty() || durableNode || !properties.empty()) {
+ bool isAutoDeleted = false;
qpid::types::Variant::Map requested = properties;
if (!type.empty()) requested[SUPPORTED_DIST_MODES] = type == TOPIC ? COPY : MOVE;
if (durableNode) requested[DURABLE] = true;
@@ -673,13 +674,23 @@ void AddressHelper::checkAssertion(pn_te
pn_data_next(data);
qpid::types::Variant::Map::const_iterator j = requested.find(key);
qpid::types::Variant v;
- if (j != requested.end() &&
- ((key == LIFETIME_POLICY && checkLifetimePolicy(j->second.asString(), data)) ||
- (read(data, v) && v.asString() == j->second.asString()))) {
+ if (key == LIFETIME_POLICY) {
+ isAutoDeleted = true;
+ if (j != requested.end() && checkLifetimePolicy(j->second.asString(), data)) {
+ requested.erase(j->first);
+ }
+ } else if (key == AUTO_DELETE) {
+ read(data, v);
+ isAutoDeleted = v.asBool();
+ } else if (j != requested.end() && (read(data, v) && v.asString() == j->second.asString())) {
requested.erase(j->first);
}
}
pn_data_exit(data);
+ qpid::types::Variant::Map::iterator i = requested.find(AUTO_DELETE);
+ if (i != requested.end() && i->second.asBool() == isAutoDeleted) {
+ requested.erase(i);
+ }
if (!requested.empty()) {
std::stringstream missing;
missing << "Requested node properties not met: " << requested;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org