summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/cluster/Cluster.cpp
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2010-01-27 22:21:02 +0000
committerAlan Conway <aconway@apache.org>2010-01-27 22:21:02 +0000
commit38391a64c2e4c091f92fecb62914b2428749806b (patch)
tree8cec03c9f926d2b6d45ce8d4baf9070779824306 /cpp/src/qpid/cluster/Cluster.cpp
parent1297c818282f26838776df418d846e07457a7f7f (diff)
downloadqpid-python-38391a64c2e4c091f92fecb62914b2428749806b.tar.gz
Cluster implementation of PeriodicTimer.
The cluster implementation multicast periodic-timer controls and executes the task when those controls are delivered, which is in the cluster delivery thread context and so consistent across the cluster. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@903867 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/cluster/Cluster.cpp')
-rw-r--r--cpp/src/qpid/cluster/Cluster.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/cpp/src/qpid/cluster/Cluster.cpp b/cpp/src/qpid/cluster/Cluster.cpp
index 779c162f9a..44b95b75b8 100644
--- a/cpp/src/qpid/cluster/Cluster.cpp
+++ b/cpp/src/qpid/cluster/Cluster.cpp
@@ -112,6 +112,7 @@
#include "qpid/cluster/RetractClient.h"
#include "qpid/cluster/FailoverExchange.h"
#include "qpid/cluster/UpdateExchange.h"
+#include "qpid/cluster/PeriodicTimerImpl.h"
#include "qpid/assert.h"
#include "qmf/org/apache/qpid/cluster/ArgsClusterStopClusterNode.h"
@@ -136,6 +137,7 @@
#include "qpid/framing/ClusterUpdateRequestBody.h"
#include "qpid/framing/ClusterConnectionAnnounceBody.h"
#include "qpid/framing/ClusterErrorCheckBody.h"
+#include "qpid/framing/ClusterPeriodicTimerBody.h"
#include "qpid/framing/MessageTransferBody.h"
#include "qpid/log/Helpers.h"
#include "qpid/log/Statement.h"
@@ -177,7 +179,7 @@ namespace _qmf = ::qmf::org::apache::qpid::cluster;
* Currently use SVN revision to avoid clashes with versions from
* different branches.
*/
-const uint32_t Cluster::CLUSTER_VERSION = 896973;
+const uint32_t Cluster::CLUSTER_VERSION = 903171;
struct ClusterDispatcher : public framing::AMQP_AllOperations::ClusterHandler {
qpid::cluster::Cluster& cluster;
@@ -207,6 +209,9 @@ struct ClusterDispatcher : public framing::AMQP_AllOperations::ClusterHandler {
void errorCheck(uint8_t type, const framing::SequenceNumber& frameSeq) {
cluster.errorCheck(member, type, frameSeq, l);
}
+ void periodicTimer(const std::string& name) {
+ cluster.periodicTimer(member, name, l);
+ }
void shutdown(const Uuid& id) { cluster.shutdown(member, id, l); }
@@ -245,6 +250,10 @@ Cluster::Cluster(const ClusterSettings& set, broker::Broker& b) :
updateRetracted(false),
error(*this)
{
+ // FIXME aconway 2010-01-26: must be done before management registers with timer.
+ broker.setPeriodicTimer(
+ std::auto_ptr<sys::PeriodicTimer>(new PeriodicTimerImpl(*this)));
+
mAgent = broker.getManagementAgent();
if (mAgent != 0){
_qmf::Package packageInit(mAgent);
@@ -952,5 +961,13 @@ void Cluster::errorCheck(const MemberId& from, uint8_t type, framing::SequenceNu
error.respondNone(from, type, frameSeq);
}
+void Cluster::periodicTimer(const MemberId&, const std::string& , Lock&) {
+ // FIXME aconway 2010-01-26:
+}
+
+bool Cluster::isElder() const {
+ Mutex::ScopedLock l(lock);
+ return elders.empty();
+}
}} // namespace qpid::cluster