summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/broker/DtxHandlerImpl.cpp
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2007-04-20 17:11:23 +0000
committerGordon Sim <gsim@apache.org>2007-04-20 17:11:23 +0000
commit53605c52439daacf4a0d96a6bf4e9c95a7425b76 (patch)
tree7c57c4153a463439a8488968eee14415c6d55253 /cpp/src/qpid/broker/DtxHandlerImpl.cpp
parent0a7a787a38f2761e21219bf99a8a2467dfac5eef (diff)
downloadqpid-python-53605c52439daacf4a0d96a6bf4e9c95a7425b76.tar.gz
Added some dtx related unit tests
Added support for suspend and resume git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@530853 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/broker/DtxHandlerImpl.cpp')
-rw-r--r--cpp/src/qpid/broker/DtxHandlerImpl.cpp41
1 files changed, 26 insertions, 15 deletions
diff --git a/cpp/src/qpid/broker/DtxHandlerImpl.cpp b/cpp/src/qpid/broker/DtxHandlerImpl.cpp
index 06b69bc20a..1c3fce9cdb 100644
--- a/cpp/src/qpid/broker/DtxHandlerImpl.cpp
+++ b/cpp/src/qpid/broker/DtxHandlerImpl.cpp
@@ -17,6 +17,7 @@
*/
#include "DtxHandlerImpl.h"
+#include <boost/format.hpp>
#include "Broker.h"
#include "BrokerChannel.h"
@@ -30,18 +31,6 @@ DtxHandlerImpl::DtxHandlerImpl(CoreRefs& parent) : CoreRefs(parent) {}
// DtxDemarcationHandler:
-void DtxHandlerImpl::end(const MethodContext& /*context*/,
- u_int16_t /*ticket*/,
- const string& /*xid*/,
- bool /*fail*/,
- bool /*suspend*/ )
-{
- channel.endDtx();
- //send end-ok
- //TODO: handle fail and suspend
- //TODO: check xid is as expected?
-}
-
void DtxHandlerImpl::select(const MethodContext& /*context*/ )
{
@@ -49,16 +38,38 @@ void DtxHandlerImpl::select(const MethodContext& /*context*/ )
//send select-ok
}
+void DtxHandlerImpl::end(const MethodContext& /*context*/,
+ u_int16_t /*ticket*/,
+ const string& xid,
+ bool fail,
+ bool suspend)
+{
+ if (fail && suspend) {
+ throw ConnectionException(503, "End and suspend cannot both be set.");
+ }
+
+ //TODO: handle fail
+ if (suspend) {
+ channel.suspendDtx(xid);
+ } else {
+ channel.endDtx(xid);
+ }
+ //send end-ok
+}
void DtxHandlerImpl::start(const MethodContext& /*context*/,
u_int16_t /*ticket*/,
const string& xid,
bool /*join*/,
- bool /*resume*/ )
+ bool resume)
{
- channel.startDtx(xid, broker.getDtxManager());
+ //TODO: handle join
+ if (resume) {
+ channel.resumeDtx(xid);
+ } else {
+ channel.startDtx(xid, broker.getDtxManager());
+ }
//send start-ok
- //TODO: handle join and resume
}
// DtxCoordinationHandler: