From efa3feb65f59e10a378b9074ac2d01b540a3278c Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Thu, 30 Aug 2007 17:06:44 +0000 Subject: - 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 --- cpp/src/qpid/cluster/ClusterPlugin.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'cpp/src/qpid/cluster/ClusterPlugin.cpp') 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 +#include namespace qpid { namespace cluster { @@ -38,23 +42,18 @@ struct ClusterPlugin : public Plugin { }; ClusterOptions options; - shared_ptr cluster; - shared_ptr sessions; + boost::optional cluster; + boost::optional sessions; - Options* getOptions() { - return &options; - } + Options* getOptions() { return &options; } void initialize(Plugin::Target& target) { broker::Broker* broker = dynamic_cast(&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)); } } }; -- cgit v1.2.1