summaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorBrian S. O'Neill <bronee@gmail.com>2008-03-25 07:04:13 +0000
committerBrian S. O'Neill <bronee@gmail.com>2008-03-25 07:04:13 +0000
commitfda7c07a82e4b3e0ffa52e13819073278efa2cd0 (patch)
treebc14f37286e87655c9a6f5becfb70698bdc194ae /src/main/java
parentbf29a6f862fae1de3c21a870229394b7c8cbe458 (diff)
More fixes for bug that allowed a transaction to be attached to multiple threads.
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/com/amazon/carbonado/spi/TransactionManager.java2
-rw-r--r--src/main/java/com/amazon/carbonado/spi/TransactionScope.java2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/main/java/com/amazon/carbonado/spi/TransactionManager.java b/src/main/java/com/amazon/carbonado/spi/TransactionManager.java
index a63784a..48f52af 100644
--- a/src/main/java/com/amazon/carbonado/spi/TransactionManager.java
+++ b/src/main/java/com/amazon/carbonado/spi/TransactionManager.java
@@ -88,7 +88,7 @@ public abstract class TransactionManager<Txn> {
// Called by TransactionScope.
boolean removeLocalScope(TransactionScope<Txn> scope) {
TransactionScope<Txn> existing = mLocalScope.get();
- if (existing == null || existing == scope) {
+ if (existing == scope) {
mLocalScope.remove();
return true;
}
diff --git a/src/main/java/com/amazon/carbonado/spi/TransactionScope.java b/src/main/java/com/amazon/carbonado/spi/TransactionScope.java
index 60e5f84..bce7804 100644
--- a/src/main/java/com/amazon/carbonado/spi/TransactionScope.java
+++ b/src/main/java/com/amazon/carbonado/spi/TransactionScope.java
@@ -236,7 +236,7 @@ public class TransactionScope<Txn> {
void detach() {
mLock.lock();
try {
- if (mTxnMgr.removeLocalScope(this)) {
+ if (mDetached || mTxnMgr.removeLocalScope(this)) {
mDetached = true;
} else {
throw new IllegalStateException("Transaction is attached to a different thread");