--- jsr166/src/test/tck/AbstractQueuedLongSynchronizerTest.java 2011/03/15 19:47:06 1.22 +++ jsr166/src/test/tck/AbstractQueuedLongSynchronizerTest.java 2011/05/06 11:22:07 1.23 @@ -134,16 +134,16 @@ public class AbstractQueuedLongSynchroni assertFalse(sync.hasQueuedThreads()); sync.acquire(1); t1.start(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); assertTrue(sync.hasQueuedThreads()); t2.start(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); assertTrue(sync.hasQueuedThreads()); t1.interrupt(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); assertTrue(sync.hasQueuedThreads()); sync.release(1); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); assertFalse(sync.hasQueuedThreads()); t1.join(); t2.join(); @@ -171,20 +171,20 @@ public class AbstractQueuedLongSynchroni assertFalse(sync.isQueued(t2)); sync.acquire(1); t1.start(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); assertTrue(sync.isQueued(t1)); t2.start(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); assertTrue(sync.isQueued(t1)); assertTrue(sync.isQueued(t2)); t1.interrupt(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); assertFalse(sync.isQueued(t1)); assertTrue(sync.isQueued(t2)); sync.release(1); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); assertFalse(sync.isQueued(t1)); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); assertFalse(sync.isQueued(t2)); t1.join(); t2.join(); @@ -200,17 +200,17 @@ public class AbstractQueuedLongSynchroni assertNull(sync.getFirstQueuedThread()); sync.acquire(1); t1.start(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); assertEquals(t1, sync.getFirstQueuedThread()); t2.start(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); assertEquals(t1, sync.getFirstQueuedThread()); t1.interrupt(); - Thread.sleep(SHORT_DELAY_MS); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); assertEquals(t2, sync.getFirstQueuedThread()); sync.release(1); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); assertNull(sync.getFirstQueuedThread()); t1.join(); t2.join(); @@ -227,16 +227,16 @@ public class AbstractQueuedLongSynchroni assertFalse(sync.hasContended()); sync.acquire(1); t1.start(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); assertTrue(sync.hasContended()); t2.start(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); assertTrue(sync.hasContended()); t1.interrupt(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); assertTrue(sync.hasContended()); sync.release(1); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); assertTrue(sync.hasContended()); t1.join(); t2.join(); @@ -253,18 +253,18 @@ public class AbstractQueuedLongSynchroni sync.acquire(1); assertTrue(sync.getQueuedThreads().isEmpty()); t1.start(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); assertTrue(sync.getQueuedThreads().contains(t1)); t2.start(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); assertTrue(sync.getQueuedThreads().contains(t1)); assertTrue(sync.getQueuedThreads().contains(t2)); t1.interrupt(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); assertFalse(sync.getQueuedThreads().contains(t1)); assertTrue(sync.getQueuedThreads().contains(t2)); sync.release(1); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); assertTrue(sync.getQueuedThreads().isEmpty()); t1.join(); t2.join(); @@ -281,18 +281,18 @@ public class AbstractQueuedLongSynchroni sync.acquire(1); assertTrue(sync.getExclusiveQueuedThreads().isEmpty()); t1.start(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); assertTrue(sync.getExclusiveQueuedThreads().contains(t1)); t2.start(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); assertTrue(sync.getExclusiveQueuedThreads().contains(t1)); assertTrue(sync.getExclusiveQueuedThreads().contains(t2)); t1.interrupt(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); assertFalse(sync.getExclusiveQueuedThreads().contains(t1)); assertTrue(sync.getExclusiveQueuedThreads().contains(t2)); sync.release(1); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); assertTrue(sync.getExclusiveQueuedThreads().isEmpty()); t1.join(); t2.join(); @@ -309,16 +309,16 @@ public class AbstractQueuedLongSynchroni sync.acquire(1); assertTrue(sync.getSharedQueuedThreads().isEmpty()); t1.start(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); assertTrue(sync.getSharedQueuedThreads().isEmpty()); t2.start(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); assertTrue(sync.getSharedQueuedThreads().isEmpty()); t1.interrupt(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); assertTrue(sync.getSharedQueuedThreads().isEmpty()); sync.release(1); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); assertTrue(sync.getSharedQueuedThreads().isEmpty()); t1.join(); t2.join(); @@ -336,7 +336,7 @@ public class AbstractQueuedLongSynchroni }}); t.start(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); t.interrupt(); t.join(); } @@ -388,12 +388,12 @@ public class AbstractQueuedLongSynchroni Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { sync.acquire(1); - Thread.sleep(SMALL_DELAY_MS); + delay(SMALL_DELAY_MS); sync.release(1); }}); t.start(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); assertTrue(sync.isHeldExclusively()); t.join(); assertFalse(sync.isHeldExclusively()); @@ -408,9 +408,9 @@ public class AbstractQueuedLongSynchroni sync.acquire(1); Thread t = new Thread(new InterruptedSyncRunnable(sync)); t.start(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); t.interrupt(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); sync.release(1); t.join(); } @@ -423,7 +423,7 @@ public class AbstractQueuedLongSynchroni sync.acquireInterruptibly(1); Thread t = new Thread(new InterruptedSyncRunnable(sync)); t.start(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); t.interrupt(); assertTrue(sync.isHeldExclusively()); t.join(); @@ -513,7 +513,7 @@ public class AbstractQueuedLongSynchroni }}); t.start(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); sync.acquire(1); c.signal(); sync.release(1); @@ -653,13 +653,13 @@ public class AbstractQueuedLongSynchroni }}); t.start(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); sync.acquire(1); assertTrue(sync.hasWaiters(c)); assertEquals(1, sync.getWaitQueueLength(c)); c.signal(); sync.release(1); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); sync.acquire(1); assertFalse(sync.hasWaiters(c)); assertEquals(0, sync.getWaitQueueLength(c)); @@ -693,15 +693,15 @@ public class AbstractQueuedLongSynchroni }}); t1.start(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); t2.start(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); sync.acquire(1); assertTrue(sync.hasWaiters(c)); assertEquals(2, sync.getWaitQueueLength(c)); c.signalAll(); sync.release(1); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); sync.acquire(1); assertFalse(sync.hasWaiters(c)); assertEquals(0, sync.getWaitQueueLength(c)); @@ -738,16 +738,16 @@ public class AbstractQueuedLongSynchroni assertTrue(sync.getWaitingThreads(c).isEmpty()); sync.release(1); t1.start(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); t2.start(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); sync.acquire(1); assertTrue(sync.hasWaiters(c)); assertTrue(sync.getWaitingThreads(c).contains(t1)); assertTrue(sync.getWaitingThreads(c).contains(t2)); c.signalAll(); sync.release(1); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); sync.acquire(1); assertFalse(sync.hasWaiters(c)); assertTrue(sync.getWaitingThreads(c).isEmpty()); @@ -774,7 +774,7 @@ public class AbstractQueuedLongSynchroni }}); t.start(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); t.interrupt(); sync.acquire(1); c.signal(); @@ -796,7 +796,7 @@ public class AbstractQueuedLongSynchroni }}); t.start(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); t.interrupt(); t.join(SHORT_DELAY_MS); assertFalse(t.isAlive()); @@ -815,7 +815,7 @@ public class AbstractQueuedLongSynchroni }}); t.start(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); t.interrupt(); t.join(SHORT_DELAY_MS); assertFalse(t.isAlive()); @@ -835,7 +835,7 @@ public class AbstractQueuedLongSynchroni }}); t.start(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); t.interrupt(); t.join(SHORT_DELAY_MS); assertFalse(t.isAlive()); @@ -863,7 +863,7 @@ public class AbstractQueuedLongSynchroni t1.start(); t2.start(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); sync.acquire(1); c.signalAll(); sync.release(1); @@ -943,7 +943,7 @@ public class AbstractQueuedLongSynchroni t.start(); assertFalse(l.isSignalled()); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); l.releaseShared(0); assertTrue(l.isSignalled()); t.join(); @@ -966,7 +966,7 @@ public class AbstractQueuedLongSynchroni t.start(); assertFalse(l.isSignalled()); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); l.releaseShared(0); assertTrue(l.isSignalled()); t.join(); @@ -1003,7 +1003,7 @@ public class AbstractQueuedLongSynchroni }}); t.start(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); assertFalse(l.isSignalled()); t.interrupt(); t.join(); @@ -1022,7 +1022,7 @@ public class AbstractQueuedLongSynchroni }}); t.start(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); assertFalse(l.isSignalled()); t.join(); }