test/java/util/concurrent/BlockingQueue/CancelledProducerConsumerLoops.java

Print this page




  17  *
  18  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  19  * CA 95054 USA or visit www.sun.com if you need additional information or
  20  * have any questions.
  21  */
  22 
  23 /*
  24  * This file is available under and governed by the GNU General Public
  25  * License version 2 only, as published by the Free Software Foundation.
  26  * However, the following notice accompanied the original version of this
  27  * file:
  28  *
  29  * Written by Doug Lea with assistance from members of JCP JSR-166
  30  * Expert Group and released to the public domain, as explained at
  31  * http://creativecommons.org/licenses/publicdomain
  32  */
  33 
  34 /*
  35  * @test
  36  * @bug 4486658
  37  * @compile -source 1.5 CancelledProducerConsumerLoops.java
  38  * @run main/timeout=7000 CancelledProducerConsumerLoops
  39  * @summary Checks for responsiveness of blocking queues to cancellation.
  40  * Runs under the assumption that ITERS computations require more than
  41  * TIMEOUT msecs to complete.
  42  */
  43 
  44 import java.util.concurrent.*;
  45 
  46 public class CancelledProducerConsumerLoops {
  47     static final int CAPACITY =      100;
  48     static final long TIMEOUT = 100;
  49 
  50     static final ExecutorService pool = Executors.newCachedThreadPool();
  51     static boolean print = false;
  52 
  53     public static void main(String[] args) throws Exception {
  54         int maxPairs = 8;
  55         int iters = 1000000;
  56 
  57         if (args.length > 0)




  17  *
  18  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  19  * CA 95054 USA or visit www.sun.com if you need additional information or
  20  * have any questions.
  21  */
  22 
  23 /*
  24  * This file is available under and governed by the GNU General Public
  25  * License version 2 only, as published by the Free Software Foundation.
  26  * However, the following notice accompanied the original version of this
  27  * file:
  28  *
  29  * Written by Doug Lea with assistance from members of JCP JSR-166
  30  * Expert Group and released to the public domain, as explained at
  31  * http://creativecommons.org/licenses/publicdomain
  32  */
  33 
  34 /*
  35  * @test
  36  * @bug 4486658
  37  * @compile CancelledProducerConsumerLoops.java
  38  * @run main/timeout=7000 CancelledProducerConsumerLoops
  39  * @summary Checks for responsiveness of blocking queues to cancellation.
  40  * Runs under the assumption that ITERS computations require more than
  41  * TIMEOUT msecs to complete.
  42  */
  43 
  44 import java.util.concurrent.*;
  45 
  46 public class CancelledProducerConsumerLoops {
  47     static final int CAPACITY =      100;
  48     static final long TIMEOUT = 100;
  49 
  50     static final ExecutorService pool = Executors.newCachedThreadPool();
  51     static boolean print = false;
  52 
  53     public static void main(String[] args) throws Exception {
  54         int maxPairs = 8;
  55         int iters = 1000000;
  56 
  57         if (args.length > 0)