675676677678679680681682683684685
Thread t2 = new Thread(new Runnable() { public void run() { try { cb.waitForTurn(3); synchronized (lock) { cb.signalTurn(4); lock.acquire(owner3, ReadWriteLock.WRITE_LOCK, true, GenericLock.COMPATIBILITY_REENTRANT, true, TIMEOUT); } lock.release(owner3); synchronized (restart) {
693694695696697698699700701702703
t2.start(); cb.waitForTurn(1); lock.acquireRead(owner1, TIMEOUT); cb.signalTurn(2); cb.waitForTurn(4); synchronized (lock) { lock.release(owner1); } synchronized (restart) {
732733734735736737738739740741742
Thread t1 = new Thread(new Runnable() { public void run() { try { cb.waitForTurn(2); manager.lock(owner2, res1, 1, true); cb.signalTurn(3); manager.releaseAll(owner2); synchronized (restart) { restart.meet(); restart.reset(); }
748749750751752753754755756757758
t1.start(); cb.waitForTurn(1); manager.startGlobalTimeout(owner1, 500); manager.lock(owner1, res1, 1, true); cb.signalTurn(2); cb.waitForTurn(3); boolean failed = false; try { manager.tryLock(owner1, res1, 1, true); } catch (LockException le) {
386387388389390391392393394395396
Thread t1 = new Thread(new Runnable() { public void run() { try { cb.waitForTurn(2); manager.readLock(owner2, res2); cb.signalTurn(3); cb.waitForTurn(5); synchronized (manager.getLock(res1)) { cb.signalTurn(6); manager.writeLock(owner2, res1); }
389390391392393394395396397398399
cb.waitForTurn(2); manager.readLock(owner2, res2); cb.signalTurn(3); cb.waitForTurn(5); synchronized (manager.getLock(res1)) { cb.signalTurn(6); manager.writeLock(owner2, res1); } } catch (LockException le) { assertEquals(le.getCode(), LockException.CODE_DEADLOCK_VICTIM); deadlockCnt++;
418419420421422423424425426427428
public void run() { try { cb.waitForTurn(3); manager.readLock(owner3, res3); synchronized (manager.getLock(res2)) { cb.signalTurn(5); manager.writeLock(owner3, res2); } } catch (LockException le) { assertEquals(le.getCode(), LockException.CODE_DEADLOCK_VICTIM); deadlockCnt++;
444445446447448449450451452453454
t2.start(); try { cb.waitForTurn(1); manager.readLock(owner1, res1); cb.signalTurn(2); cb.waitForTurn(6); manager.writeLock(owner1, res3); } catch (LockException le) { assertEquals(le.getCode(), LockException.CODE_DEADLOCK_VICTIM); deadlockCnt++;