rm.startTransaction("tx1");
// first both threads get a lock, this one on res2
rm.createResource("tx1", "key2");
synchronized (deadlockBarrier1) {
deadlockBarrier1.meet();
deadlockBarrier1.reset();
}
// if I am first, the other thread will be dead, i.e.
// exactly one
rm.createResource("tx1", "key1");
rm.commitTransaction("tx1");