From 17716fee99670e49a1c3526a44c40d15757d94e3 Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Thu, 6 Nov 2008 22:40:57 +0000 Subject: Add Message callbacks for async completion. Add unit test for async completion. Add sync parameter to generated session functions, defaults as before but allows greater control. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@711998 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/broker/Broker.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'cpp/src/qpid/broker/Broker.cpp') diff --git a/cpp/src/qpid/broker/Broker.cpp b/cpp/src/qpid/broker/Broker.cpp index be13538ca6..3ba2e70bc2 100644 --- a/cpp/src/qpid/broker/Broker.cpp +++ b/cpp/src/qpid/broker/Broker.cpp @@ -194,16 +194,12 @@ Broker::Broker(const Broker::Options& conf) : (*i)->earlyInitialize(*this); // If no plugin store module registered itself, set up the null store. - if (store == 0) + if (store.get() == 0) setStore (new NullMessageStore (false)); - queues.setStore (store); - dtxManager.setStore (store); - links.setStore (store); - exchanges.declare(empty, DirectExchange::typeName); // Default exchange. - if (store != 0) { + if (store.get() != 0) { RecoveryManagerImpl recoverer(queues, exchanges, links, dtxManager, conf.stagingThreshold); store->recover(recoverer); @@ -247,7 +243,7 @@ Broker::Broker(const Broker::Options& conf) : void Broker::declareStandardExchange(const std::string& name, const std::string& type) { - bool storeEnabled = store != NULL; + bool storeEnabled = store.get() != NULL; std::pair status = exchanges.declare(name, type, storeEnabled); if (status.second && storeEnabled) { store->create(*status.first, framing::FieldTable ()); @@ -269,9 +265,10 @@ boost::intrusive_ptr Broker::create(const Options& opts) void Broker::setStore (MessageStore* _store) { - assert (store == 0 && _store != 0); - if (store == 0 && _store != 0) - store = new MessageStoreModule (_store); + store.reset(new MessageStoreModule (_store)); + queues.setStore (store.get()); + dtxManager.setStore (store.get()); + links.setStore (store.get()); } void Broker::run() { @@ -304,7 +301,6 @@ void Broker::shutdown() { Broker::~Broker() { shutdown(); finalize(); // Finalize any plugins. - delete store; if (config.auth) SaslAuthenticator::fini(); QPID_LOG(notice, "Shut down"); -- cgit v1.2.1