416417418419420421422423424425426
{ System.out.println("Transaction was rolled back, this is correct"); } finally { tm.resume(tx2); tm.rollback(); } // Sleep, as the commit call to cache2 is async TestingUtil.sleepThread(1000);
188189190191192193194195196197198
LocalTransaction localTx = txTable.getLocalTransaction(localTxId); if (localTx == null) { throw new IllegalStateException("Local tx not found but present in the tx table!"); } TransactionManager txManager = txManager(); txManager.resume(localTx.getTransaction()); if (commit) { txManager.commit(); } else { txManager.rollback(); }
414415416417418419420421422423424
} finally { if (toResume != null) { tm.resume(toResume); } } if (ok) {
6061626364656667686970
assert cache.getNode(AB) == null; tm.commit(); assert cache.getNode(AB) == null; tm.resume(reader); assert cache.getNode(AB) != null; assert "v".equals(cache.get(AB, "k")); tm.commit(); assert cache.getNode(AB) == null;
90919293949596979899100
tm.commit(); assert cache.getNode(AB) != null; assert "v".equals(cache.get(AB, "k")); tm.resume(reader); assert cache.getNode(AB) == null; assert cache.get(AB, "k") == null; tm.commit(); assert cache.getNode(AB) != null;
6970717273747576777879
{ mgr.begin(); c.put("/a", "k", "v"); Transaction t = mgr.suspend(); c.put("/a", "k2", "v2"); mgr.resume(t); mgr.commit(); assertTrue("Expecting a rollback exception!", false); } catch (RollbackException re) {
348349350351352353354355356357358
Transaction tx = mgr.suspend(); // now remove the original node... c.removeNode(fqn); mgr.resume(tx); // now try and commit this - this should fail. boolean ok = false; try { mgr.commit();
381382383384385386387388389390391
Transaction tx = mgr.suspend(); // now change the original node... c.put(fqn, "key3", "value3"); mgr.resume(tx); // now try and commit this - this should fail. boolean ok = false; try { mgr.commit();
4243444546474849505152
mgr.begin(); cache.put("/b", "key", "value2"); mgr.commit(); mgr.resume(tx1); try { mgr.commit(); assertTrue("Should have failed", false); }
250251252253254255256257258259260
mgr.commit(); assertEquals(1, cache.getTransactionTable().getNumGlobalTransactions()); assertEquals(1, cache.getTransactionTable().getNumLocalTransactions()); mgr.resume(tx); boolean fail = false; try { mgr.commit();