diff options
| author | Gordon Sim <gsim@apache.org> | 2008-06-10 09:59:17 +0000 |
|---|---|---|
| committer | Gordon Sim <gsim@apache.org> | 2008-06-10 09:59:17 +0000 |
| commit | da7c7265de8a5a70480f6e467c6c5f115fb6de58 (patch) | |
| tree | 4393a8fb90936e7a25c27030b382eb367a87eeed /qpid/cpp/src | |
| parent | c748d3affc1dff412bfa17ee94d5f9f41dee6579 (diff) | |
| download | qpid-python-da7c7265de8a5a70480f6e467c6c5f115fb6de58.tar.gz | |
Improved exception handling for commit.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@666051 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src')
| -rw-r--r-- | qpid/cpp/src/qpid/broker/TxBuffer.cpp | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/qpid/cpp/src/qpid/broker/TxBuffer.cpp b/qpid/cpp/src/qpid/broker/TxBuffer.cpp index 5b5b00e929..cdc5b37dfd 100644 --- a/qpid/cpp/src/qpid/broker/TxBuffer.cpp +++ b/qpid/cpp/src/qpid/broker/TxBuffer.cpp @@ -19,6 +19,7 @@ * */ #include "TxBuffer.h" +#include "qpid/log/Statement.h" #include <boost/mem_fn.hpp> using boost::mem_fn; @@ -53,15 +54,22 @@ void TxBuffer::enlist(TxOp::shared_ptr op) bool TxBuffer::commitLocal(TransactionalStore* const store) { - std::auto_ptr<TransactionContext> ctxt; - if(store) ctxt = store->begin(); - if (prepare(ctxt.get())) { - if(store) store->commit(*ctxt); - commit(); - return true; - } else { - if(store) store->abort(*ctxt); - rollback(); - return false; + if (!store) return false; + try { + std::auto_ptr<TransactionContext> ctxt = store->begin(); + if (prepare(ctxt.get())) { + store->commit(*ctxt); + commit(); + return true; + } else { + store->abort(*ctxt); + rollback(); + return false; + } + } catch (std::exception& e) { + QPID_LOG(error, "Commit failed with exception: " << e.what()); + } catch (...) { + QPID_LOG(error, "Commit failed with unknown exception"); } + return false; } |
