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

Comparing jsr166/src/test/loops/ProducerConsumerLoops.java (file contents):
Revision 1.11 by jsr166, Sat Dec 31 19:37:25 2016 UTC vs.
Revision 1.14 by jsr166, Sat Dec 31 21:34:47 2016 UTC

# Line 4 | Line 4
4   * http://creativecommons.org/publicdomain/zero/1.0/
5   */
6  
7 import java.util.Random;
7   import java.util.concurrent.ArrayBlockingQueue;
8   import java.util.concurrent.BlockingQueue;
9   import java.util.concurrent.CyclicBarrier;
# Line 19 | Line 18 | import java.util.concurrent.SynchronousQ
18  
19   public class ProducerConsumerLoops {
20      static final int NCPUS = Runtime.getRuntime().availableProcessors();
22    static final Random rng = new Random();
21      static final ExecutorService pool = Executors.newCachedThreadPool();
22      static boolean print = false;
23      static int producerSum;
# Line 245 | Line 243 | public class ProducerConsumerLoops {
243      static final class LTQasSQ<T> extends LinkedTransferQueue<T> {
244          LTQasSQ() { super(); }
245          public void put(T x) {
246 <            try { super.transfer(x);
247 <            } catch (InterruptedException ex) { throw new Error(); }
246 >            try { super.transfer(x); }
247 >            catch (InterruptedException ex) { throw new Error(ex); }
248          }
249      }
250  
# Line 257 | Line 255 | public class ProducerConsumerLoops {
255              if ((++calls & 1) == 0)
256                  super.put(x);
257              else {
258 <                try { super.transfer(x);
259 <                } catch (InterruptedException ex) {
262 <                    throw new Error();
263 <                }
258 >                try { super.transfer(x); }
259 >                catch (InterruptedException ex) { throw new Error(ex); }
260              }
261          }
262      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines