393 |
|
} |
394 |
|
|
395 |
|
/** |
396 |
– |
* take blocks interruptibly when empty |
397 |
– |
*/ |
398 |
– |
public void testTakeFromEmpty() throws InterruptedException { |
399 |
– |
final ArrayBlockingQueue q = new ArrayBlockingQueue(2); |
400 |
– |
Thread t = new ThreadShouldThrow(InterruptedException.class) { |
401 |
– |
public void realRun() throws InterruptedException { |
402 |
– |
q.take(); |
403 |
– |
}}; |
404 |
– |
|
405 |
– |
t.start(); |
406 |
– |
Thread.sleep(SHORT_DELAY_MS); |
407 |
– |
t.interrupt(); |
408 |
– |
t.join(); |
409 |
– |
} |
410 |
– |
|
411 |
– |
/** |
396 |
|
* Take removes existing elements until empty, then blocks interruptibly |
397 |
|
*/ |
398 |
|
public void testBlockingTake() throws InterruptedException { |