[rhmessaging-commits] rhmessaging commits: r1478 - store/trunk/cpp/lib.
rhmessaging-commits at lists.jboss.org
rhmessaging-commits at lists.jboss.org
Thu Dec 13 12:55:25 EST 2007
Author: gordonsim
Date: 2007-12-13 12:55:25 -0500 (Thu, 13 Dec 2007)
New Revision: 1478
Modified:
store/trunk/cpp/lib/BdbMessageStore.cpp
Log:
Put bdb ops for loadContent in a transaction to avoid deadlocking
Modified: store/trunk/cpp/lib/BdbMessageStore.cpp
===================================================================
--- store/trunk/cpp/lib/BdbMessageStore.cpp 2007-12-13 17:19:52 UTC (rev 1477)
+++ store/trunk/cpp/lib/BdbMessageStore.cpp 2007-12-13 17:55:25 UTC (rev 1478)
@@ -865,6 +865,13 @@
return;
}
}
+ } catch (const journal::jexception& e) {
+ THROW_STORE_EXCEPTION(std::string("Queue ") + queue.getName() +
+ ": loadContent() failed: " + e.what());
+ }
+ TxnCtxt txn;
+ txn.begin(env, true);
+ try {
Dbt key (&messageId, sizeof(messageId));
char *buffer = new char[length];
Dbt value(buffer, length);
@@ -872,20 +879,19 @@
value.set_ulen(length);
value.set_doff(realOffset);
value.set_dlen(length);
- int status = messageDb.get(0, &key, &value, 0);
+ int status = messageDb.get(txn.get(), &key, &value, 0);
if (status == DB_NOTFOUND) {
+ txn.abort();
delete [] buffer;
THROW_STORE_EXCEPTION("Cannot load content. Message not known to store!");
} else {
+ txn.commit();
data.assign(buffer, value.get_size());
delete [] buffer;
}
} catch (const DbException& e) {
THROW_STORE_EXCEPTION_2("Error loading content", e);
- } catch (const journal::jexception& e) {
- THROW_STORE_EXCEPTION(std::string("Queue ") + queue.getName() +
- ": loadContent() failed: " + e.what());
- }
+ }
} else {
THROW_STORE_EXCEPTION("Cannot load content. Message not known to store!");
}
More information about the rhmessaging-commits
mailing list