final Object k = getKeyForCache(0);
final Object k1= getKeyForCache(1);
tm(0).begin();
cache(0).put(k, "v");
DummyTransaction dtm = (DummyTransaction) tm(0).getTransaction();
tm(0).suspend();
assert checkTxCount(0, 1, 0);
assert checkTxCount(1, 0, 0);
assert checkTxCount(2, 0, 0);
tm(0).begin();
cache(0).put(k1, "some");
try {
cache(0).put(k, "other");
} catch (Throwable e) {
//ignore
} finally {
tm(0).rollback();
}
assertNotLocked(k1);
eventually(new AbstractInfinispanTest.Condition() {
@Override
public boolean isSatisfied() throws Exception {
return checkTxCount(0, 1, 0) && checkTxCount(1, 0, 0) && checkTxCount(2, 0, 0);
}
});
log.info("Before second failure");
tm(1).begin();
cache(1).put(k1, "some");
try {
cache(1).put(k, "other");
assert false;
} catch (Throwable e) {
//expected
} finally {
tm(1).rollback();
}
assertNotLocked(k1);
eventually(new AbstractInfinispanTest.Condition() {
@Override
public boolean isSatisfied() throws Exception {
return checkTxCount(0, 1, 0) && checkTxCount(1, 0, 0) && checkTxCount(1, 0, 0);
}
});
log.trace("about to commit transaction.");
tm(0).resume(dtm);
dtm.runPrepare();
dtm.runCommitTx();
tm(0).suspend();
assertValue(k, false);
eventually(new AbstractInfinispanTest.Condition() {