From 6d83b6405aa6d47b0e24dfa3be04eb841841f013 Mon Sep 17 00:00:00 2001 From: Pavel Moravec Date: Thu, 5 Sep 2013 07:29:36 +0000 Subject: fixing QPID-5108 git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1520245 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qpid/broker/SemanticState.cpp | 3 +++ qpid/cpp/src/qpid/broker/SessionState.cpp | 18 ++++++++++++++++++ qpid/cpp/src/qpid/broker/SessionState.h | 5 +++++ 3 files changed, 26 insertions(+) (limited to 'qpid/cpp/src') diff --git a/qpid/cpp/src/qpid/broker/SemanticState.cpp b/qpid/cpp/src/qpid/broker/SemanticState.cpp index c1a68923d7..0b4d9f0032 100644 --- a/qpid/cpp/src/qpid/broker/SemanticState.cpp +++ b/qpid/cpp/src/qpid/broker/SemanticState.cpp @@ -168,12 +168,14 @@ void SemanticState::startTx() { txBuffer = TxBuffer::shared_ptr(new TxBuffer()); session.getBroker().getBrokerObservers().startTx(txBuffer); + session.startTx(); //just to update statistics } void SemanticState::commit(MessageStore* const store) { if (!txBuffer) throw CommandInvalidException(QPID_MSG("Session has not been selected for use with transactions")); + session.commitTx(); //just to update statistics TxOp::shared_ptr txAck(static_cast(new TxAccept(accumulatedAck, unacked))); txBuffer->enlist(txAck); if (txBuffer->commitLocal(store)) { @@ -187,6 +189,7 @@ void SemanticState::rollback() { if (!txBuffer) throw CommandInvalidException(QPID_MSG("Session has not been selected for use with transactions")); + session.rollbackTx(); //just to update statistics txBuffer->rollback(); accumulatedAck.clear(); } diff --git a/qpid/cpp/src/qpid/broker/SessionState.cpp b/qpid/cpp/src/qpid/broker/SessionState.cpp index 421dc008a9..6ee3a693bc 100644 --- a/qpid/cpp/src/qpid/broker/SessionState.cpp +++ b/qpid/cpp/src/qpid/broker/SessionState.cpp @@ -79,6 +79,24 @@ void SessionState::addManagementObject() { } } +void SessionState::startTx() { + if (mgmtObject) { mgmtObject->inc_TxnStarts(); } +} + +void SessionState::commitTx() { + if (mgmtObject) { + mgmtObject->inc_TxnCommits(); + mgmtObject->inc_TxnCount(); + } +} + +void SessionState::rollbackTx() { + if (mgmtObject) { + mgmtObject->inc_TxnRejects(); + mgmtObject->inc_TxnCount(); + } +} + SessionState::~SessionState() { asyncCommandCompleter->cancel(); semanticState.closed(); diff --git a/qpid/cpp/src/qpid/broker/SessionState.h b/qpid/cpp/src/qpid/broker/SessionState.h index daf3767969..500a211a6f 100644 --- a/qpid/cpp/src/qpid/broker/SessionState.h +++ b/qpid/cpp/src/qpid/broker/SessionState.h @@ -127,6 +127,11 @@ class SessionState : public qpid::SessionState, // belonging to inter-broker bridges void addManagementObject(); + // transaction-related methods just to update statistics + void startTx(); + void commitTx(); + void rollbackTx(); + private: void handleCommand(framing::AMQMethodBody* method, const framing::SequenceNumber& id); void handleContent(framing::AMQFrame& frame, const framing::SequenceNumber& id); -- cgit v1.2.1