assert lock.getHoldCount() == 0;
}
public void testReentrancyNotSameGtx()
{
InvocationContextContainer icc = getInvocationContextContainer();
OwnableReentrantLock lock = new OwnableReentrantLock(icc);
// create and set a gtx
GlobalTransaction gtx = new GlobalTransaction();
gtx.setId(10);
icc.get().setGlobalTransaction(gtx);
GlobalTransaction gtx2 = new GlobalTransaction();
gtx2.setId(10);
assert gtx != gtx2;
lock.lock(); // locked by current thread
assert lock.getOwner().equals(gtx);
assert lock.getHoldCount() == 1;
icc.get().setGlobalTransaction(gtx2);
lock.lock();
assert lock.getOwner().equals(gtx2);
assert lock.getHoldCount() == 2;
lock.unlock();
assert lock.getOwner().equals(gtx2);
assert lock.getHoldCount() == 1;
icc.get().setGlobalTransaction(gtx);
lock.unlock();
assert lock.getOwner() == null;
assert lock.getHoldCount() == 0;
}