diff options
| author | Alan Conway <aconway@apache.org> | 2013-04-19 02:00:16 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2013-04-19 02:00:16 +0000 |
| commit | cf171ceead7d5395135625567b188808600d076e (patch) | |
| tree | d4eaab184da2b040884872dd65c3fbdc19a8a8f9 /cpp/src/qpid/ha/StatusCheck.cpp | |
| parent | de62dddc069e223caf346c5ebadfec902c69dac6 (diff) | |
| download | qpid-python-cf171ceead7d5395135625567b188808600d076e.tar.gz | |
QPID-4748: Consistent handling of durations in broker configuration, allowing sub-second intervals.
Provides string conversion for sys::Duration, allowing intervals to be expressed like this:
10.5 - value in seconds, backward compatible.
10.5s - value in seconds
10.5ms - value in milliseconds
10.5us - value in microseconds
10.5ns - value in nanoseconds
Converted the folllowing broker options to Duration:
mgmtPubInterval, queueCleanInterval, linkMaintenanceInterval, linkHeartbeatInterval
Did not convert: maxNegotiateTime. This is expressed in milliseconds so it would not be
backward compatible to make it a Duration.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1469661 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/ha/StatusCheck.cpp')
| -rw-r--r-- | cpp/src/qpid/ha/StatusCheck.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/cpp/src/qpid/ha/StatusCheck.cpp b/cpp/src/qpid/ha/StatusCheck.cpp index 17613ce3dd..2921b9ec55 100644 --- a/cpp/src/qpid/ha/StatusCheck.cpp +++ b/cpp/src/qpid/ha/StatusCheck.cpp @@ -46,21 +46,21 @@ class StatusCheckThread : public sys::Runnable { private: Url url; StatusCheck& statusCheck; - uint16_t linkHeartbeatInterval; + sys::Duration linkHeartbeatInterval; BrokerInfo brokerInfo; }; void StatusCheckThread::run() { QPID_LOG(debug, statusCheck.logPrefix << "Checking status of " << url); - Variant::Map options, clientProperties; - clientProperties = brokerInfo.asMap(); // Detect self connections. - clientProperties["qpid.ha-admin"] = 1; // Allow connection to backups. + try { + Variant::Map options, clientProperties; + clientProperties = brokerInfo.asMap(); // Detect self connections. + clientProperties["qpid.ha-admin"] = 1; // Allow connection to backups. - options["client-properties"] = clientProperties; - options["heartbeat"] = statusCheck.linkHeartbeatInterval; - Connection c(url.str(), options); + options["client-properties"] = clientProperties; + options["heartbeat"] = statusCheck.linkHeartbeatInterval/sys::TIME_SEC; + Connection c(url.str(), options); - try { c.open(); Session session = c.createSession(); messaging::Address responses("#;{create:always,node:{x-declare:{exclusive:True,auto-delete:True,arguments:{'qpid.replicate':none}}}}"); @@ -78,7 +78,7 @@ void StatusCheckThread::run() { content["_object_id"] = oid; encode(content, request); s.send(request); - Message response = r.fetch(statusCheck.linkHeartbeatInterval*Duration::SECOND); + Message response = r.fetch(messaging::Duration(linkHeartbeatInterval/TIME_MSEC)); session.acknowledge(); Variant::List contentIn; decode(response, contentIn); @@ -98,7 +98,7 @@ void StatusCheckThread::run() { delete this; } -StatusCheck::StatusCheck(const string& lp, uint16_t lh, const BrokerInfo& self) +StatusCheck::StatusCheck(const string& lp, sys::Duration lh, const BrokerInfo& self) : logPrefix(lp), promote(true), linkHeartbeatInterval(lh), brokerInfo(self) {} |
