diff options
author | Alan Conway <aconway@apache.org> | 2007-08-30 17:06:44 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2007-08-30 17:06:44 +0000 |
commit | efa3feb65f59e10a378b9074ac2d01b540a3278c (patch) | |
tree | 5cb9c87f71b6f428365e377376280d2792481b40 /cpp/src/qpid/cluster/ClusterPlugin.cpp | |
parent | f6c5c0d464efd4a19af54cbbb68a2ae315fbfd96 (diff) | |
download | qpid-python-efa3feb65f59e10a378b9074ac2d01b540a3278c.tar.gz |
- Update cluster code to work with new FrameHandler
- Update ClassifierHandler to use Visitor rather than map.
- Replace heap allocation in cluster classes with boost::optional.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@571246 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/cluster/ClusterPlugin.cpp')
-rw-r--r-- | cpp/src/qpid/cluster/ClusterPlugin.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/cpp/src/qpid/cluster/ClusterPlugin.cpp b/cpp/src/qpid/cluster/ClusterPlugin.cpp index b00152cbcd..4e95a42560 100644 --- a/cpp/src/qpid/cluster/ClusterPlugin.cpp +++ b/cpp/src/qpid/cluster/ClusterPlugin.cpp @@ -20,6 +20,10 @@ #include "qpid/cluster/SessionManager.h" #include "qpid/Plugin.h" #include "qpid/Options.h" +#include "qpid/shared_ptr.h" + +#include <boost/optional.hpp> +#include <boost/utility/in_place_factory.hpp> namespace qpid { namespace cluster { @@ -38,23 +42,18 @@ struct ClusterPlugin : public Plugin { }; ClusterOptions options; - shared_ptr<Cluster> cluster; - shared_ptr<SessionManager> sessions; + boost::optional<Cluster> cluster; + boost::optional<SessionManager> sessions; - Options* getOptions() { - return &options; - } + Options* getOptions() { return &options; } void initialize(Plugin::Target& target) { broker::Broker* broker = dynamic_cast<broker::Broker*>(&target); // Only provide to a Broker, and only if the --cluster config is set. if (broker && !options.clusterName.empty()) { assert(!cluster); // A process can only belong to one cluster. - - sessions.reset(new SessionManager(*broker)); - cluster.reset(new Cluster(options.clusterName, broker->getUrl(), sessions)); - sessions->setClusterSend(cluster); - broker->add(sessions); + cluster = boost::in_place(options.clusterName, broker->getUrl(), boost::ref(*broker)); + broker->add(make_shared_ptr(&cluster->getHandlerUpdater(), nullDeleter)); } } }; |