summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/broker/Queue.cpp
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2008-11-27 12:21:04 +0000
committerGordon Sim <gsim@apache.org>2008-11-27 12:21:04 +0000
commit6b67c025160e2363052820b9f686bbf386d9c96a (patch)
treeca52122fc4ea53e6a93e2653f33c36f4a97d756a /cpp/src/qpid/broker/Queue.cpp
parentdf072598b37b31e9a7cf72818c9aa87b2ee21f70 (diff)
downloadqpid-python-6b67c025160e2363052820b9f686bbf386d9c96a.tar.gz
* QPID-1488: test that policy pointer is set
* don't flow to disk for null store implementation * add checks for undeflow in queue policy git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@721166 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/broker/Queue.cpp')
-rw-r--r--cpp/src/qpid/broker/Queue.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/cpp/src/qpid/broker/Queue.cpp b/cpp/src/qpid/broker/Queue.cpp
index b1f9163bb5..a78744598c 100644
--- a/cpp/src/qpid/broker/Queue.cpp
+++ b/cpp/src/qpid/broker/Queue.cpp
@@ -24,6 +24,7 @@
#include "Exchange.h"
#include "DeliverableMessage.h"
#include "MessageStore.h"
+#include "NullMessageStore.h"
#include "QueueRegistry.h"
#include "qpid/StringUtils.h"
@@ -741,12 +742,15 @@ void Queue::encode(Buffer& buffer) const
{
buffer.putShortString(name);
buffer.put(settings);
- buffer.put(*policy);
+ if (policy.get()) {
+ buffer.put(*policy);
+ }
}
uint32_t Queue::encodedSize() const
{
- return name.size() + 1/*short string size octet*/ + settings.encodedSize() + (*policy).encodedSize();
+ return name.size() + 1/*short string size octet*/ + settings.encodedSize()
+ + (policy.get() ? (*policy).encodedSize() : 0);
}
Queue::shared_ptr Queue::decode(QueueRegistry& queues, Buffer& buffer)
@@ -756,7 +760,9 @@ Queue::shared_ptr Queue::decode(QueueRegistry& queues, Buffer& buffer)
std::pair<Queue::shared_ptr, bool> result = queues.declare(name, true);
buffer.get(result.first->settings);
result.first->configure(result.first->settings);
- buffer.get ( *(result.first->policy) );
+ if (result.first->policy.get()) {
+ buffer.get ( *(result.first->policy) );
+ }
return result.first;
}
@@ -828,7 +834,7 @@ void Queue::setExternalQueueStore(ExternalQueueStore* inst) {
bool Queue::releaseMessageContent(const QueuedMessage& m)
{
- if (store) {
+ if (store && !NullMessageStore::isNullStore(store)) {
QPID_LOG(debug, "Message " << m.position << " on " << name << " released from memory");
m.payload->releaseContent(store);
return true;