Author: gordonsim
Date: 2011-09-01 17:18:49 -0400 (Thu, 01 Sep 2011)
New Revision: 4476
Modified:
store/trunk/cpp/lib/StorePlugin.cpp
Log:
BZ-735208: Broker::getStore() is never the same as what was passed in to
Broker::setStore(); hold on to pointer in plugin for enabling management.
Modified: store/trunk/cpp/lib/StorePlugin.cpp
===================================================================
--- store/trunk/cpp/lib/StorePlugin.cpp 2011-09-01 19:27:52 UTC (rev 4475)
+++ store/trunk/cpp/lib/StorePlugin.cpp 2011-09-01 21:18:49 UTC (rev 4476)
@@ -38,6 +38,7 @@
struct StorePlugin : public Plugin {
MessageStoreImpl::StoreOptions options;
+ boost::shared_ptr<MessageStoreImpl> store;
Options* getOptions() { return &options; }
@@ -45,7 +46,7 @@
{
Broker* broker = dynamic_cast<Broker*>(&target);
if (!broker) return;
- boost::shared_ptr<MessageStoreImpl> store(new
MessageStoreImpl(broker->getTimer()));
+ store.reset(new MessageStoreImpl(broker->getTimer()));
DataDir& dataDir = broker->getDataDir ();
if (options.storeDir.empty ())
{
@@ -64,7 +65,6 @@
{
Broker* broker = dynamic_cast<Broker*>(&target);
if (!broker) return;
- MessageStoreImpl*
store=dynamic_cast<MessageStoreImpl*>(&broker->getStore());
if (!store) return;
// Not done in earlyInitialize as the Broker::isInCluster test won't work
there.
if (broker->isInCluster()) {
@@ -77,7 +77,7 @@
void finalize()
{
- // This function intentionally left blank
+ store.reset();
}
const char* id() {return "StorePlugin";}
Show replies by date