summaryrefslogtreecommitdiff
path: root/src/main/java/com/amazon/carbonado/repo/sleepycat
diff options
context:
space:
mode:
authorBrian S. O'Neill <bronee@gmail.com>2007-10-23 18:09:08 +0000
committerBrian S. O'Neill <bronee@gmail.com>2007-10-23 18:09:08 +0000
commitf4b5012d20abe94c62e8d3b3c3d8ed626dff925b (patch)
tree7ed1c262d617a829dea07cef2964cb34e1f8e97d /src/main/java/com/amazon/carbonado/repo/sleepycat
parent81578d7b6798fe5b268d1227cf33d24897d5bdaa (diff)
Deprecated use of ExceptionTransformer in TransactionManager.
Diffstat (limited to 'src/main/java/com/amazon/carbonado/repo/sleepycat')
-rw-r--r--src/main/java/com/amazon/carbonado/repo/sleepycat/BDBTransactionManager.java23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBTransactionManager.java b/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBTransactionManager.java
index 58a9e8d..f9b0c6c 100644
--- a/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBTransactionManager.java
+++ b/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBTransactionManager.java
@@ -22,6 +22,7 @@ import java.lang.ref.WeakReference;
import java.util.concurrent.TimeUnit;
import com.amazon.carbonado.IsolationLevel;
+import com.amazon.carbonado.PersistException;
import com.amazon.carbonado.Transaction;
import com.amazon.carbonado.spi.ExceptionTransformer;
@@ -35,12 +36,14 @@ import com.amazon.carbonado.spi.TransactionManager;
* @author Brian S O'Neill
*/
class BDBTransactionManager<Txn> extends TransactionManager<Txn> {
+ private final ExceptionTransformer mExTransformer;
+
// Weakly reference repository because thread locals are not cleaned up
// very quickly and BDB environments hang on to a ton of memory.
private final WeakReference<BDBRepository<Txn>> mRepositoryRef;
BDBTransactionManager(ExceptionTransformer exTransformer, BDBRepository<Txn> repository) {
- super(exTransformer);
+ mExTransformer = exTransformer;
mRepositoryRef = new WeakReference<BDBRepository<Txn>>(repository);
}
@@ -69,13 +72,21 @@ class BDBTransactionManager<Txn> extends TransactionManager<Txn> {
}
}
- protected boolean commitTxn(Txn txn) throws Exception {
- repository().txn_commit(txn);
- return false;
+ protected boolean commitTxn(Txn txn) throws PersistException {
+ try {
+ repository().txn_commit(txn);
+ return false;
+ } catch (Throwable e) {
+ throw mExTransformer.toPersistException(e);
+ }
}
- protected void abortTxn(Txn txn) throws Exception {
- repository().txn_abort(txn);
+ protected void abortTxn(Txn txn) throws PersistException {
+ try {
+ repository().txn_abort(txn);
+ } catch (Throwable e) {
+ throw mExTransformer.toPersistException(e);
+ }
}
private BDBRepository<Txn> repository() {