diff options
author | Gordon Sim <gsim@apache.org> | 2007-05-25 11:24:54 +0000 |
---|---|---|
committer | Gordon Sim <gsim@apache.org> | 2007-05-25 11:24:54 +0000 |
commit | 45f0ee18e3dacf9e8c746009eaef4e17b0a44bf8 (patch) | |
tree | 67a2ae89ca92c9b4fdc94e2f6a817439e648d069 /cpp/src/qpid/broker/DtxManager.cpp | |
parent | f646350b5e59ccf49f1253bd55f98d062769f2ee (diff) | |
download | qpid-python-45f0ee18e3dacf9e8c746009eaef4e17b0a44bf8.tar.gz |
Added support for recovering prepared transactions.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@541619 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/broker/DtxManager.cpp')
-rw-r--r-- | cpp/src/qpid/broker/DtxManager.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/cpp/src/qpid/broker/DtxManager.cpp b/cpp/src/qpid/broker/DtxManager.cpp index 6c074bbd51..2af87a8751 100644 --- a/cpp/src/qpid/broker/DtxManager.cpp +++ b/cpp/src/qpid/broker/DtxManager.cpp @@ -29,11 +29,20 @@ DtxManager::~DtxManager() {} void DtxManager::start(std::string xid, DtxBuffer::shared_ptr ops) { + /* WorkMap::iterator i = work.find(xid); if (i == work.end()) { i = work.insert(xid, new DtxWorkRecord(xid, store)).first; } i->add(ops); + */ + + getOrCreateWork(xid)->add(ops); +} + +void DtxManager::recover(std::string xid, std::auto_ptr<TPCTransactionContext> txn, DtxBuffer::shared_ptr ops) +{ + getOrCreateWork(xid)->recover(txn, ops); } void DtxManager::prepare(const std::string& xid) @@ -54,6 +63,17 @@ void DtxManager::rollback(const std::string& xid) DtxManager::WorkMap::iterator DtxManager::getWork(const std::string& xid) { WorkMap::iterator i = work.find(xid); - if (i == work.end()) throw ConnectionException(503, boost::format("Unrecognised xid %1%!") % xid); + if (i == work.end()) { + throw ConnectionException(503, boost::format("Unrecognised xid %1%!") % xid); + } + return i; +} + +DtxManager::WorkMap::iterator DtxManager::getOrCreateWork(std::string& xid) +{ + WorkMap::iterator i = work.find(xid); + if (i == work.end()) { + i = work.insert(xid, new DtxWorkRecord(xid, store)).first; + } return i; } |