summaryrefslogtreecommitdiff
path: root/qpid/cpp
diff options
context:
space:
mode:
authorPavel Moravec <pmoravec@apache.org>2013-09-05 07:29:36 +0000
committerPavel Moravec <pmoravec@apache.org>2013-09-05 07:29:36 +0000
commit6d83b6405aa6d47b0e24dfa3be04eb841841f013 (patch)
tree93c1bfda2ff4e72a1ae1fbc8374d42ebe107e1f5 /qpid/cpp
parent4ca6fc898223f21601d6c24ad380beb031786330 (diff)
downloadqpid-python-6d83b6405aa6d47b0e24dfa3be04eb841841f013.tar.gz
fixing QPID-5108
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1520245 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp')
-rw-r--r--qpid/cpp/src/qpid/broker/SemanticState.cpp3
-rw-r--r--qpid/cpp/src/qpid/broker/SessionState.cpp18
-rw-r--r--qpid/cpp/src/qpid/broker/SessionState.h5
3 files changed, 26 insertions, 0 deletions
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<TxOp*>(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);