1 |
|
/* |
2 |
– |
* @test %I% %E% |
3 |
– |
* @bug 4486658 |
4 |
– |
* @compile -source 1.5 CancelledProducerConsumerLoops.java |
5 |
– |
* @run main/timeout=7000 CancelledProducerConsumerLoops |
6 |
– |
* @summary Checks for responsiveness of blocking queues to cancellation. |
7 |
– |
* Runs under the assumption that ITERS computations require more than |
8 |
– |
* TIMEOUT msecs to complete. |
9 |
– |
*/ |
10 |
– |
/* |
2 |
|
* Written by Doug Lea with assistance from members of JCP JSR-166 |
3 |
< |
* Expert Group and released to the public domain. Use, modify, and |
4 |
< |
* redistribute this code in any way without acknowledgement. |
3 |
> |
* Expert Group and released to the public domain, as explained at |
4 |
> |
* http://creativecommons.org/licenses/publicdomain |
5 |
|
*/ |
15 |
– |
|
6 |
|
import java.util.concurrent.*; |
7 |
|
|
8 |
|
public class CancelledProducerConsumerLoops { |
97 |
|
System.out.print("SynchronousQueue(fair) "); |
98 |
|
oneRun(new SynchronousQueue<Integer>(true), pairs, iters / 8); |
99 |
|
|
100 |
+ |
/* Can legitimately run out of memory before cancellation |
101 |
|
if (print) |
102 |
|
System.out.print("PriorityBlockingQueue "); |
103 |
|
oneRun(new PriorityBlockingQueue<Integer>(ITERS / 2 * pairs), pairs, iters / 4); |
104 |
+ |
*/ |
105 |
|
} |
106 |
|
|
107 |
|
static abstract class Stage implements Callable { |