diff options
author | Alan Conway <aconway@apache.org> | 2012-09-14 18:47:58 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2012-09-14 18:47:58 +0000 |
commit | 4a7350e3cdb6702c9128f1bb38347cea874d6eb7 (patch) | |
tree | fdbf051f8cdc0f7c084acd52cd89637c0f0100eb /cpp/src | |
parent | c9e96f18e52dfd8cc2c543dd9eb88b501d9689be (diff) | |
download | qpid-python-4a7350e3cdb6702c9128f1bb38347cea874d6eb7.tar.gz |
NO-JIRA: HA improved logging messages.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1384881 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/qpid/ha/ConnectionObserver.cpp | 6 | ||||
-rw-r--r-- | cpp/src/qpid/ha/ConnectionObserver.h | 2 | ||||
-rw-r--r-- | cpp/src/qpid/ha/HaBroker.cpp | 5 | ||||
-rw-r--r-- | cpp/src/qpid/ha/Primary.cpp | 2 | ||||
-rw-r--r-- | cpp/src/qpid/ha/QueueGuard.cpp | 1 | ||||
-rw-r--r-- | cpp/src/qpid/ha/ReplicatingSubscription.cpp | 5 |
6 files changed, 12 insertions, 9 deletions
diff --git a/cpp/src/qpid/ha/ConnectionObserver.cpp b/cpp/src/qpid/ha/ConnectionObserver.cpp index 81ba3e4301..775222efd3 100644 --- a/cpp/src/qpid/ha/ConnectionObserver.cpp +++ b/cpp/src/qpid/ha/ConnectionObserver.cpp @@ -30,7 +30,7 @@ namespace qpid { namespace ha { ConnectionObserver::ConnectionObserver(HaBroker& hb, const types::Uuid& uuid) - : haBroker(hb), logPrefix("Connections: "), self(uuid) {} + : haBroker(hb), logPrefix("Backup: "), self(uuid) {} bool ConnectionObserver::getBrokerInfo(const broker::Connection& connection, BrokerInfo& info) { framing::FieldTable ft; @@ -41,9 +41,11 @@ bool ConnectionObserver::getBrokerInfo(const broker::Connection& connection, Bro return false; } -void ConnectionObserver::setObserver(const ObserverPtr& o){ +void ConnectionObserver::setObserver(const ObserverPtr& o, const std::string& newlogPrefix) +{ sys::Mutex::ScopedLock l(lock); observer = o; + logPrefix = newlogPrefix; } ConnectionObserver::ObserverPtr ConnectionObserver::getObserver() { diff --git a/cpp/src/qpid/ha/ConnectionObserver.h b/cpp/src/qpid/ha/ConnectionObserver.h index e3a6d1154a..5374660dbe 100644 --- a/cpp/src/qpid/ha/ConnectionObserver.h +++ b/cpp/src/qpid/ha/ConnectionObserver.h @@ -55,7 +55,7 @@ class ConnectionObserver : public broker::ConnectionObserver ConnectionObserver(HaBroker& haBroker, const types::Uuid& self); - void setObserver(const ObserverPtr&); + void setObserver(const ObserverPtr&, const std::string& logPrefix); ObserverPtr getObserver(); void opened(broker::Connection& connection); diff --git a/cpp/src/qpid/ha/HaBroker.cpp b/cpp/src/qpid/ha/HaBroker.cpp index b555b33e13..88627307f2 100644 --- a/cpp/src/qpid/ha/HaBroker.cpp +++ b/cpp/src/qpid/ha/HaBroker.cpp @@ -54,6 +54,7 @@ using namespace std; using types::Variant; using types::Uuid; using sys::Mutex; +using boost::shared_ptr; // Called in Plugin::earlyInitialize HaBroker::HaBroker(broker::Broker& b, const Settings& s) @@ -72,8 +73,8 @@ HaBroker::HaBroker(broker::Broker& b, const Settings& s) // initialize() if (settings.cluster) { QPID_LOG(debug, logPrefix << "Rejecting client connections."); - observer->setObserver(boost::shared_ptr<broker::ConnectionObserver>( - new BackupConnectionExcluder)); + shared_ptr<broker::ConnectionObserver> excluder(new BackupConnectionExcluder); + observer->setObserver(excluder, "Backup: "); broker.getConnectionObservers().add(observer); } } diff --git a/cpp/src/qpid/ha/Primary.cpp b/cpp/src/qpid/ha/Primary.cpp index e4bf9671b8..f36d409b3f 100644 --- a/cpp/src/qpid/ha/Primary.cpp +++ b/cpp/src/qpid/ha/Primary.cpp @@ -109,7 +109,7 @@ Primary::Primary(HaBroker& hb, const BrokerInfo::Set& expect) : checkReady(l); // Allow client connections connectionObserver.reset(new PrimaryConnectionObserver(*this)); - haBroker.getObserver()->setObserver(connectionObserver); + haBroker.getObserver()->setObserver(connectionObserver, logPrefix); } Primary::~Primary() { diff --git a/cpp/src/qpid/ha/QueueGuard.cpp b/cpp/src/qpid/ha/QueueGuard.cpp index 77e1f81a38..b0ef167176 100644 --- a/cpp/src/qpid/ha/QueueGuard.cpp +++ b/cpp/src/qpid/ha/QueueGuard.cpp @@ -97,6 +97,7 @@ void QueueGuard::completeRange(Delayed::iterator begin, Delayed::iterator end) { } void QueueGuard::cancel() { + QPID_LOG(debug, logPrefix << "Cancelled"); queue.removeObserver(observer); Delayed removed; { diff --git a/cpp/src/qpid/ha/ReplicatingSubscription.cpp b/cpp/src/qpid/ha/ReplicatingSubscription.cpp index 4be737e025..5fcb316ce6 100644 --- a/cpp/src/qpid/ha/ReplicatingSubscription.cpp +++ b/cpp/src/qpid/ha/ReplicatingSubscription.cpp @@ -222,9 +222,7 @@ ReplicatingSubscription::ReplicatingSubscription( } } -ReplicatingSubscription::~ReplicatingSubscription() { - QPID_LOG(debug, logPrefix << "Detroyed replicating subscription"); -} +ReplicatingSubscription::~ReplicatingSubscription() {} // Called in subscription's connection thread when the subscription is created. // Called separate from ctor because sending events requires @@ -292,6 +290,7 @@ void ReplicatingSubscription::setReady() { // Called in the subscription's connection thread. void ReplicatingSubscription::cancel() { + QPID_LOG(debug, logPrefix << "Cancelled"); guard->cancel(); ConsumerImpl::cancel(); } |