ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/loops/CancelledProducerConsumerLoops.java
(Generate patch)

Comparing jsr166/src/test/loops/CancelledProducerConsumerLoops.java (file contents):
Revision 1.11 by jsr166, Tue Mar 15 19:47:05 2011 UTC vs.
Revision 1.16 by jsr166, Wed Oct 28 06:30:09 2015 UTC

# Line 6 | Line 6
6   import java.util.concurrent.*;
7  
8   public class CancelledProducerConsumerLoops {
9 <    static final int CAPACITY =      100;
9 >    static final int CAPACITY = 100;
10      static final long TIMEOUT = 100;
11  
12      static final ExecutorService pool = Executors.newCachedThreadPool();
# Line 32 | Line 32 | public class CancelledProducerConsumerLo
32              Thread.sleep(100);
33          }
34          pool.shutdown();
35 <   }
35 >    }
36  
37      static void oneRun(BlockingQueue<Integer> q, int npairs, int iters) throws Exception {
38          LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer();
39          CyclicBarrier barrier = new CyclicBarrier(npairs * 2 + 1, timer);
40 <        Future[] prods = new Future[npairs];
41 <        Future[] cons = new Future[npairs];
40 >        Future<?>[] prods = new Future<?>[npairs];
41 >        Future<?>[] cons = new Future<?>[npairs];
42  
43          for (int i = 0; i < npairs; ++i) {
44              prods[i] = pool.submit(new Producer(q, barrier, iters));
# Line 95 | Line 95 | public class CancelledProducerConsumerLo
95              System.out.print("SynchronousQueue        ");
96          oneRun(new SynchronousQueue<Integer>(), pairs, iters / 8);
97  
98
98          if (print)
99              System.out.print("SynchronousQueue(fair)  ");
100          oneRun(new SynchronousQueue<Integer>(true), pairs, iters / 8);
# Line 156 | Line 155 | public class CancelledProducerConsumerLo
155              return new Integer(s);
156          }
157      }
159
160
158   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines