diff options
Diffstat (limited to 'src/main/java/com/amazon/carbonado/txn')
-rw-r--r-- | src/main/java/com/amazon/carbonado/txn/TransactionPair.java | 5 | ||||
-rw-r--r-- | src/main/java/com/amazon/carbonado/txn/TransactionScope.java | 11 |
2 files changed, 13 insertions, 3 deletions
diff --git a/src/main/java/com/amazon/carbonado/txn/TransactionPair.java b/src/main/java/com/amazon/carbonado/txn/TransactionPair.java index f719a79..e247661 100644 --- a/src/main/java/com/amazon/carbonado/txn/TransactionPair.java +++ b/src/main/java/com/amazon/carbonado/txn/TransactionPair.java @@ -110,4 +110,9 @@ public class TransactionPair implements Transaction { public boolean preCommit() throws PersistException {
return mPrimaryTransaction.preCommit() ? mSecondaryTransaction.preCommit() : false;
}
+
+ @Override
+ public void close() throws PersistException {
+ exit();
+ }
}
diff --git a/src/main/java/com/amazon/carbonado/txn/TransactionScope.java b/src/main/java/com/amazon/carbonado/txn/TransactionScope.java index 6e94b91..6061c62 100644 --- a/src/main/java/com/amazon/carbonado/txn/TransactionScope.java +++ b/src/main/java/com/amazon/carbonado/txn/TransactionScope.java @@ -216,7 +216,7 @@ public class TransactionScope<Txn> { mLock.unlock();
}
}
-
+
/**
* Returns the implementation for the active transaction, only if it exists.
* (does not create a transaction like getTxn()
@@ -323,10 +323,10 @@ public class TransactionScope<Txn> { mLock.unlock();
return;
}
-
+
Map<Class<?>, CursorList<TransactionImpl<Txn>>> cursors;
try {
- cursors = mCursors;
+ cursors = mCursors;
// Ensure that map is freed promptly. Thread-local reference to
// this scope otherwise keeps map and its contents lingering around
@@ -427,6 +427,11 @@ public class TransactionScope<Txn> { }
}
+ @Override
+ public void close() throws PersistException {
+ exit();
+ }
+
public void commit() throws PersistException {
TransactionScope<Txn> scope = mScope;
scope.mLock.lock();
|