summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/broker/Broker.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/qpid/broker/Broker.cpp')
-rw-r--r--cpp/src/qpid/broker/Broker.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/cpp/src/qpid/broker/Broker.cpp b/cpp/src/qpid/broker/Broker.cpp
index f47b6418bd..cd3b014256 100644
--- a/cpp/src/qpid/broker/Broker.cpp
+++ b/cpp/src/qpid/broker/Broker.cpp
@@ -137,7 +137,6 @@ const std::string knownHostsNone("none");
Broker::Broker(const Broker::Options& conf) :
poller(new Poller),
- periodicTimer(new sys::PeriodicTimerImpl(timer)),
config(conf),
managementAgent(conf.enableMgmt ? new ManagementAgent() : 0),
store(new NullMessageStore),
@@ -258,6 +257,12 @@ Broker::Broker(const Broker::Options& conf) :
// Initialize plugins
Plugin::initializeAll(*this);
+ if (!periodicTimer.hasDelegate()) {
+ // If no plugin has contributed a PeriodicTimer, use the default one.
+ periodicTimer.setDelegate(
+ std::auto_ptr<sys::PeriodicTimer>(new sys::PeriodicTimerImpl(timer)));
+ }
+
if (conf.queueCleanInterval) {
queueCleaner.start(conf.queueCleanInterval * qpid::sys::TIME_SEC);
}
@@ -469,6 +474,10 @@ Broker::getKnownBrokersImpl()
return knownBrokers;
}
+void Broker::setPeriodicTimer(std::auto_ptr<sys::PeriodicTimer> pt) {
+ periodicTimer.setDelegate(pt);
+}
+
const std::string Broker::TCP_TRANSPORT("tcp");
}} // namespace qpid::broker