From 71952848c6fac8d9105e5cf08db7fb76fb77cf5c Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Tue, 25 Mar 2008 15:00:06 +0000 Subject: More fixes for bug that allowed a transaction to be attached to multiple threads. --- .../carbonado/spi/TestTransactionManager.java | 26 +++++++++++++--------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'src/test') diff --git a/src/test/java/com/amazon/carbonado/spi/TestTransactionManager.java b/src/test/java/com/amazon/carbonado/spi/TestTransactionManager.java index 8747424..1029a3d 100644 --- a/src/test/java/com/amazon/carbonado/spi/TestTransactionManager.java +++ b/src/test/java/com/amazon/carbonado/spi/TestTransactionManager.java @@ -71,7 +71,7 @@ public class TestTransactionManager extends TestCase { ExecutorService es = Executors.newSingleThreadExecutor(); - Transaction txn2 = es.submit(new Callable() { + final Transaction txn2 = es.submit(new Callable() { public Transaction call() { return mTxnMgr.localScope().enter(null); } @@ -91,6 +91,18 @@ public class TestTransactionManager extends TestCase { txn.detach(); + try { + txn2.attach(); + fail(); + } catch (IllegalStateException e) { + } + + es.submit(new Runnable() { + public void run() { + txn2.detach(); + } + }).get(); + txn2.attach(); txn2.detach(); txn2.attach(); @@ -101,11 +113,7 @@ public class TestTransactionManager extends TestCase { } catch (IllegalStateException e) { } - try { - txn.detach(); - fail(); - } catch (IllegalStateException e) { - } + txn.detach(); txn2.exit(); @@ -115,11 +123,7 @@ public class TestTransactionManager extends TestCase { } catch (IllegalStateException e) { } - try { - txn.detach(); - fail(); - } catch (IllegalStateException e) { - } + txn.detach(); txn2.detach(); -- cgit v1.2.3