66 |
|
* Returns a new queue of given size containing consecutive |
67 |
|
* Integers 0 ... n - 1. |
68 |
|
*/ |
69 |
< |
private PriorityBlockingQueue<Integer> populatedQueue(int n) { |
69 |
> |
private static PriorityBlockingQueue<Integer> populatedQueue(int n) { |
70 |
|
PriorityBlockingQueue<Integer> q = |
71 |
|
new PriorityBlockingQueue<Integer>(n); |
72 |
|
assertTrue(q.isEmpty()); |
333 |
|
final CountDownLatch pleaseInterrupt = new CountDownLatch(1); |
334 |
|
Thread t = newStartedThread(new CheckedRunnable() { |
335 |
|
public void realRun() throws InterruptedException { |
336 |
< |
for (int i = 0; i < SIZE; ++i) { |
337 |
< |
assertEquals(i, q.take()); |
338 |
< |
} |
336 |
> |
for (int i = 0; i < SIZE; i++) assertEquals(i, q.take()); |
337 |
|
|
338 |
|
Thread.currentThread().interrupt(); |
339 |
|
try { |
351 |
|
}}); |
352 |
|
|
353 |
|
await(pleaseInterrupt); |
354 |
< |
assertThreadStaysAlive(t); |
354 |
> |
assertThreadBlocks(t, Thread.State.WAITING); |
355 |
|
t.interrupt(); |
356 |
|
awaitTermination(t); |
357 |
|
} |
416 |
|
} |
417 |
|
}}); |
418 |
|
|
419 |
< |
aboutToWait.await(); |
419 |
> |
await(aboutToWait); |
420 |
|
waitForThreadToEnterWaitState(t); |
421 |
|
t.interrupt(); |
422 |
|
awaitTermination(t); |