From b07b0a633be48c74122f5a0cb04eafc57fb6a96b Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Mon, 5 Nov 2007 13:17:01 +0000 Subject: Suspension of one xid on a channel should allow for work on other xids to be done prior to resuming the initial xid. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@591986 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/broker/SemanticState.cpp | 13 +++++++++++++ cpp/src/qpid/broker/SemanticState.h | 2 ++ 2 files changed, 15 insertions(+) (limited to 'cpp/src') diff --git a/cpp/src/qpid/broker/SemanticState.cpp b/cpp/src/qpid/broker/SemanticState.cpp index 7339150642..8651b9034c 100644 --- a/cpp/src/qpid/broker/SemanticState.cpp +++ b/cpp/src/qpid/broker/SemanticState.cpp @@ -185,10 +185,23 @@ void SemanticState::suspendDtx(const std::string& xid) checkDtxTimeout(); dtxBuffer->setSuspended(true); + suspendedXids[xid] = dtxBuffer; + dtxBuffer.reset(); } void SemanticState::resumeDtx(const std::string& xid) { + if (!dtxSelected) { + throw CommandInvalidException(QPID_MSG("Session has not been selected for use with dtx")); + } + + dtxBuffer = suspendedXids[xid]; + if (!dtxBuffer) { + throw CommandInvalidException(QPID_MSG("xid " << xid << " not attached")); + } else { + suspendedXids.erase(xid); + } + if (dtxBuffer->getXid() != xid) { throw CommandInvalidException( QPID_MSG("xid specified on start was " << dtxBuffer->getXid() << ", but " << xid << " specified on resume")); diff --git a/cpp/src/qpid/broker/SemanticState.h b/cpp/src/qpid/broker/SemanticState.h index 87ae937cfb..bb126287a3 100644 --- a/cpp/src/qpid/broker/SemanticState.h +++ b/cpp/src/qpid/broker/SemanticState.h @@ -103,6 +103,7 @@ class SemanticState : public framing::FrameHandler::Chains, }; typedef std::map ConsumerImplMap; + typedef std::map DtxBufferMap; SessionState& session; DeliveryAdapter& deliveryAdapter; @@ -117,6 +118,7 @@ class SemanticState : public framing::FrameHandler::Chains, TxBuffer::shared_ptr txBuffer; DtxBuffer::shared_ptr dtxBuffer; bool dtxSelected; + DtxBufferMap suspendedXids; framing::AccumulatedAck accumulatedAck; bool flowActive; -- cgit v1.2.1