try
{
TransactionalDatabase<?, ?> tdb1 = (TransactionalDatabase<?, ?>) mp.get("db1");
TransactionalDatabase<?, ?> tdb2 = (TransactionalDatabase<?, ?>) mp.get("db2");
// Start a transaction and count down the latch
Transaction txn = Transaction.startTransaction(false);
try
{
// Let the databases join the transaction
tdb1.joinTransaction(false);
tdb2.joinTransaction(false);
l1.countDown();
l1.await();
l1 = null;
// Sleep awhile to give the other thread plenty
// of time to
// set the flag
Thread.sleep(1000);
// Still not set
assertFalse(((AtomicBoolean) mp.get("flag1")).get());
}
finally
{
txn.rollback();
}
}
finally
{
if (l1 != null)
{
l1.countDown();
}
}
}
} }, new TestStep[] { new TestStep() {
public void runStep(Map<String, Object> mp) throws Exception
{
CountDownLatch l1 = (CountDownLatch) mp.get("latch1");
try
{
TransactionalDatabase<?, ?> tdb1 = (TransactionalDatabase<?, ?>) mp.get("db1");
TransactionalDatabase<?, ?> tdb2 = (TransactionalDatabase<?, ?>) mp.get("db2");
Transaction txn = Transaction.startTransaction(false);
try
{
l1.countDown();
l1.await();
l1 = null;
// Try to join the transaction. This should not
// be possible until the other thread leaves it
tdb1.joinTransaction(false);
tdb2.joinTransaction(false);
((AtomicBoolean) mp.get("flag1")).set(true);
}
finally
{
txn.rollback();
}
}
finally
{
if (l1 != null)