diff options
Diffstat (limited to 'cpp/src/qpid')
-rw-r--r-- | cpp/src/qpid/broker/MessageStoreModule.cpp | 6 | ||||
-rw-r--r-- | cpp/src/qpid/broker/MessageStoreModule.h | 3 | ||||
-rw-r--r-- | cpp/src/qpid/broker/NullMessageStore.cpp | 16 |
3 files changed, 21 insertions, 4 deletions
diff --git a/cpp/src/qpid/broker/MessageStoreModule.cpp b/cpp/src/qpid/broker/MessageStoreModule.cpp index 20f5b98b6b..96186d508b 100644 --- a/cpp/src/qpid/broker/MessageStoreModule.cpp +++ b/cpp/src/qpid/broker/MessageStoreModule.cpp @@ -20,6 +20,7 @@ */ #include "MessageStoreModule.h" +#include "NullMessageStore.h" #include <iostream> // This transfer protects against the unloading of the store lib prior to the handling of the exception @@ -165,4 +166,9 @@ void MessageStoreModule::collectPreparedXids(std::set<std::string>& xids) TRANSFER_EXCEPTION(store->collectPreparedXids(xids)); } +bool MessageStoreModule::isNull() const +{ + return NullMessageStore::isNullStore(store); +} + }} // namespace qpid::broker diff --git a/cpp/src/qpid/broker/MessageStoreModule.h b/cpp/src/qpid/broker/MessageStoreModule.h index a16ef4de21..0b51610a46 100644 --- a/cpp/src/qpid/broker/MessageStoreModule.h +++ b/cpp/src/qpid/broker/MessageStoreModule.h @@ -73,7 +73,8 @@ class MessageStoreModule : public MessageStore const PersistableQueue& queue); uint32_t outstandingQueueAIO(const PersistableQueue& queue); void flush(const qpid::broker::PersistableQueue& queue); - + bool isNull() const; + ~MessageStoreModule(); }; diff --git a/cpp/src/qpid/broker/NullMessageStore.cpp b/cpp/src/qpid/broker/NullMessageStore.cpp index 4c13c2adef..ad0143ce43 100644 --- a/cpp/src/qpid/broker/NullMessageStore.cpp +++ b/cpp/src/qpid/broker/NullMessageStore.cpp @@ -20,8 +20,10 @@ */ #include "NullMessageStore.h" +#include "MessageStoreModule.h" #include "RecoveryManager.h" #include "qpid/log/Statement.h" +#include "qpid/framing/reply_exceptions.h" #include <iostream> @@ -90,7 +92,10 @@ void NullMessageStore::appendContent(const intrusive_ptr<const PersistableMessag void NullMessageStore::loadContent(const qpid::broker::PersistableQueue&, const intrusive_ptr<const PersistableMessage>&, - string&, uint64_t, uint32_t) {} + string&, uint64_t, uint32_t) +{ + throw qpid::framing::InternalErrorException("Can't load content; persistence not enabled"); +} void NullMessageStore::enqueue(TransactionContext*, const intrusive_ptr<PersistableMessage>& msg, @@ -149,8 +154,13 @@ bool NullMessageStore::isNull() const bool NullMessageStore::isNullStore(const MessageStore* store) { - const NullMessageStore* test = dynamic_cast<const NullMessageStore*>(store); - return test && test->isNull(); + const MessageStoreModule* wrapper = dynamic_cast<const MessageStoreModule*>(store); + if (wrapper) { + return wrapper->isNull(); + } else { + const NullMessageStore* test = dynamic_cast<const NullMessageStore*>(store); + return test && test->isNull(); + } } }} // namespace qpid::broker |