summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/Plugin.cpp
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2009-11-24 20:07:24 +0000
committerAlan Conway <aconway@apache.org>2009-11-24 20:07:24 +0000
commit0fb7ff9cfbfd01e9093c2c6021a5915696d2a089 (patch)
tree1d2db335592be80a9aa9f8f404d2c1682afeb485 /cpp/src/qpid/Plugin.cpp
parent1ee447563d208b39e962537a47f14aea741777b0 (diff)
downloadqpid-python-0fb7ff9cfbfd01e9093c2c6021a5915696d2a089.tar.gz
Support for restarting a persistent cluster.
Option --cluster-size=N: members wait for N members before recovering store. Stores marked as clean/dirty. Automatically recover from clean store on restart. Stores marked with UUID to detect errors. Not yet implemented: consistency checks, manual recovery from all dirty stores. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@883842 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/Plugin.cpp')
-rw-r--r--cpp/src/qpid/Plugin.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/cpp/src/qpid/Plugin.cpp b/cpp/src/qpid/Plugin.cpp
index 4368e15d27..196b5c2333 100644
--- a/cpp/src/qpid/Plugin.cpp
+++ b/cpp/src/qpid/Plugin.cpp
@@ -50,9 +50,16 @@ void Plugin::Target::addFinalizer(const boost::function<void()>& f) {
finalizers.push_back(f);
}
+namespace {
+bool initBefore(const Plugin* a, const Plugin* b) {
+ return a->initOrder() < b->initOrder();
+}
+}
+
Plugin::Plugin() {
// Register myself.
thePlugins().push_back(this);
+ std::sort(thePlugins().begin(), thePlugins().end(), &initBefore);
}
Plugin::~Plugin() {}
@@ -74,7 +81,14 @@ void Plugin::addOptions(Options& opts) {
}
}
-void Plugin::earlyInitAll(Target& t) { each_plugin(boost::bind(&Plugin::earlyInitialize, _1, boost::ref(t))); }
-void Plugin::initializeAll(Target& t) { each_plugin(boost::bind(&Plugin::initialize, _1, boost::ref(t))); }
+int Plugin::initOrder() const { return DEFAULT_INIT_ORDER; }
+
+void Plugin::earlyInitAll(Target& t) {
+ each_plugin(boost::bind(&Plugin::earlyInitialize, _1, boost::ref(t)));
+}
+
+void Plugin::initializeAll(Target& t) {
+ each_plugin(boost::bind(&Plugin::initialize, _1, boost::ref(t)));
+}
} // namespace qpid