/** getExclusiveQueuedThreads returns all exclusive waiting threads */ public void testGetExclusiveQueuedThreads() { final Mutex sync = new Mutex(); Thread t1 = new Thread(new InterruptedSyncRunnable(sync)); Thread t2 = new Thread(new InterruptibleSyncRunnable(sync)); assertHasExclusiveQueuedThreads(sync, NO_THREADS); sync.acquire(); assertHasExclusiveQueuedThreads(sync, NO_THREADS); t1.start(); waitForQueuedThread(sync, t1); assertHasExclusiveQueuedThreads(sync, t1); assertTrue(sync.getExclusiveQueuedThreads().contains(t1)); assertFalse(sync.getExclusiveQueuedThreads().contains(t2)); t2.start(); waitForQueuedThread(sync, t2); assertHasExclusiveQueuedThreads(sync, t1, t2); assertTrue(sync.getExclusiveQueuedThreads().contains(t1)); assertTrue(sync.getExclusiveQueuedThreads().contains(t2)); t1.interrupt(); awaitTermination(t1); assertHasExclusiveQueuedThreads(sync, t2); sync.release(); awaitTermination(t2); assertHasExclusiveQueuedThreads(sync, NO_THREADS); }