From fda7c07a82e4b3e0ffa52e13819073278efa2cd0 Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Tue, 25 Mar 2008 07:04:13 +0000 Subject: More fixes for bug that allowed a transaction to be attached to multiple threads. --- src/main/java/com/amazon/carbonado/spi/TransactionManager.java | 2 +- src/main/java/com/amazon/carbonado/spi/TransactionScope.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') 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 { // Called by TransactionScope. boolean removeLocalScope(TransactionScope scope) { TransactionScope 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 { 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"); -- cgit v1.2.3