diff options
| author | Alan Conway <aconway@apache.org> | 2012-10-03 16:34:35 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2012-10-03 16:34:35 +0000 |
| commit | 37d36ad78c21893e5b8194fd338f3b38c972bc4e (patch) | |
| tree | 6ce1b978322e718d6b63c244740c85bbd9846ca5 | |
| parent | b9d9e21d7101653957a2fdea17f392d188aaa056 (diff) | |
| download | qpid-python-37d36ad78c21893e5b8194fd338f3b38c972bc4e.tar.gz | |
NO-JIRA: Add log messages to identify QueueReplicator associated with a session error.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1393597 13f79535-47bb-0310-9956-ffa450edef68
| -rw-r--r-- | qpid/cpp/src/qpid/ha/QueueReplicator.cpp | 22 | ||||
| -rw-r--r-- | qpid/cpp/src/qpid/ha/QueueReplicator.h | 1 |
2 files changed, 23 insertions, 0 deletions
diff --git a/qpid/cpp/src/qpid/ha/QueueReplicator.cpp b/qpid/cpp/src/qpid/ha/QueueReplicator.cpp index c8341ccef3..69c8a56873 100644 --- a/qpid/cpp/src/qpid/ha/QueueReplicator.cpp +++ b/qpid/cpp/src/qpid/ha/QueueReplicator.cpp @@ -28,6 +28,7 @@ #include "qpid/broker/Queue.h" #include "qpid/broker/QueueRegistry.h" #include "qpid/broker/SessionHandler.h" +#include "qpid/broker/SessionHandler.h" #include "qpid/framing/SequenceSet.h" #include "qpid/framing/FieldTable.h" #include "qpid/log/Statement.h" @@ -60,6 +61,25 @@ bool QueueReplicator::isEventKey(const std::string key) { return ret; } +class QueueReplicator::ErrorListener : public SessionHandler::ErrorListener { + public: + ErrorListener(const std::string& prefix) : logPrefix(prefix) {} + void connectionException(framing::connection::CloseCode, const std::string& msg) { + QPID_LOG(error, logPrefix << "Connection error: " << msg); + } + void channelException(framing::session::DetachCode, const std::string& msg) { + QPID_LOG(error, logPrefix << "Channel error: " << msg); + } + void executionException(framing::execution::ErrorCode, const std::string& msg) { + QPID_LOG(error, logPrefix << "Execution error: " << msg); + } + void detach() { + QPID_LOG(error, logPrefix << "Unexpectedly detached."); + } + private: + std::string logPrefix; +}; + QueueReplicator::QueueReplicator(HaBroker& hb, boost::shared_ptr<Queue> q, boost::shared_ptr<Link> l) @@ -96,6 +116,8 @@ void QueueReplicator::activate() { boost::bind(&QueueReplicator::initializeBridge, shared_from_this(), _1, _2) ); bridge = result.first; + bridge->setErrorListener( + boost::shared_ptr<ErrorListener>(new ErrorListener(logPrefix))); } QueueReplicator::~QueueReplicator() { deactivate(); } diff --git a/qpid/cpp/src/qpid/ha/QueueReplicator.h b/qpid/cpp/src/qpid/ha/QueueReplicator.h index f8a68ea38f..c9eb318aa1 100644 --- a/qpid/cpp/src/qpid/ha/QueueReplicator.h +++ b/qpid/cpp/src/qpid/ha/QueueReplicator.h @@ -78,6 +78,7 @@ class QueueReplicator : public broker::Exchange, bool isBound(boost::shared_ptr<broker::Queue>, const std::string* const, const framing::FieldTable* const); private: + class ErrorListener; void initializeBridge(broker::Bridge& bridge, broker::SessionHandler& sessionHandler); void dequeue(framing::SequenceNumber, sys::Mutex::ScopedLock&); |
