You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gs...@apache.org on 2008/06/10 11:59:17 UTC
svn commit: r666051 -
/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/TxBuffer.cpp
Author: gsim
Date: Tue Jun 10 02:59:17 2008
New Revision: 666051
URL: http://svn.apache.org/viewvc?rev=666051&view=rev
Log:
Improved exception handling for commit.
Modified:
incubator/qpid/trunk/qpid/cpp/src/qpid/broker/TxBuffer.cpp
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/TxBuffer.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/TxBuffer.cpp?rev=666051&r1=666050&r2=666051&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/TxBuffer.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/TxBuffer.cpp Tue Jun 10 02:59:17 2008
@@ -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 @@
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;
}