rhmessaging commits: r4446 - store/trunk/cpp/lib.
by rhmessaging-commits@lists.jboss.org
Author: aconway
Date: 2011-03-04 13:57:42 -0500 (Fri, 04 Mar 2011)
New Revision: 4446
Modified:
store/trunk/cpp/lib/StorePlugin.cpp
Log:
Disable management of store and journal in a cluster.
The store updates statistics and properties of store and journal
managed objects in timer threads, which can create inconsistencies in
a cluster.
Modified: store/trunk/cpp/lib/StorePlugin.cpp
===================================================================
--- store/trunk/cpp/lib/StorePlugin.cpp 2011-03-01 20:08:48 UTC (rev 4445)
+++ store/trunk/cpp/lib/StorePlugin.cpp 2011-03-04 18:57:42 UTC (rev 4446)
@@ -25,8 +25,10 @@
#include "qpid/Plugin.h"
#include "qpid/Options.h"
#include "qpid/DataDir.h"
+#include "qpid/log/Statement.h"
#include "MessageStoreImpl.h"
+using mrg::msgstore::MessageStoreImpl;
namespace qpid {
namespace broker {
@@ -35,7 +37,7 @@
struct StorePlugin : public Plugin {
- mrg::msgstore::MessageStoreImpl::StoreOptions options;
+ MessageStoreImpl::StoreOptions options;
Options* getOptions() { return &options; }
@@ -43,7 +45,7 @@
{
Broker* broker = dynamic_cast<Broker*>(&target);
if (!broker) return;
- boost::shared_ptr<qpid::broker::MessageStore> store(new mrg::msgstore::MessageStoreImpl (broker->getTimer()));
+ boost::shared_ptr<MessageStoreImpl> store(new MessageStoreImpl(broker->getTimer()));
DataDir& dataDir = broker->getDataDir ();
if (options.storeDir.empty ())
{
@@ -52,16 +54,25 @@
options.storeDir = dataDir.getPath ();
}
- MessageStore* sp = store.get();
- static_cast<mrg::msgstore::MessageStoreImpl*>(sp)->init(&options);
- broker->setStore (store);
+ store->init(&options);
+ boost::shared_ptr<qpid::broker::MessageStore> brokerStore(store);
+ broker->setStore(brokerStore);
target.addFinalizer(boost::bind(&StorePlugin::finalize, this));
- static_cast<mrg::msgstore::MessageStoreImpl*>(sp)->initManagement(broker);
}
- void initialize(Plugin::Target&)
+ void initialize(Plugin::Target& target)
{
- // This function intentionally left blank
+ 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()) {
+ QPID_LOG(info, "Disabling management instrumentation for the store in a cluster.");
+ } else {
+ QPID_LOG(info, "Enabling management instrumentation for the store.");
+ store->initManagement(broker);
+ }
}
void finalize()