< prev index next >

test/java/util/concurrent/locks/ReentrantLock/TimeoutLockLoops.java

Print this page




  18  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  19  * or visit www.oracle.com if you need additional information or have any
  20  * 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/publicdomain/zero/1.0/
  32  */
  33 
  34 /*
  35  * @test
  36  * @bug 4486658 5031862
  37  * @run main TimeoutLockLoops
  38  * @key intermittent
  39  * @summary Checks for responsiveness of locks to timeouts.
  40  * Runs under the assumption that ITERS computations require more than
  41  * TIMEOUT msecs to complete, which seems to be a safe assumption for
  42  * another decade.
  43  */
  44 
  45 import java.util.concurrent.*;
  46 import java.util.concurrent.locks.*;
  47 import java.util.*;
  48 
  49 public final class TimeoutLockLoops {
  50     static final ExecutorService pool = Executors.newCachedThreadPool();
  51     static final LoopHelpers.SimpleRandom rng = new LoopHelpers.SimpleRandom();
  52     static boolean print = false;
  53     static final int ITERS = Integer.MAX_VALUE;
  54     static final long TIMEOUT = 100;
  55 
  56     public static void main(String[] args) throws Exception {
  57         int maxThreads = 100;
  58         if (args.length > 0)




  18  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  19  * or visit www.oracle.com if you need additional information or have any
  20  * 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/publicdomain/zero/1.0/
  32  */
  33 
  34 /*
  35  * @test
  36  * @bug 4486658 5031862
  37  * @run main TimeoutLockLoops

  38  * @summary Checks for responsiveness of locks to timeouts.
  39  * Runs under the assumption that ITERS computations require more than
  40  * TIMEOUT msecs to complete, which seems to be a safe assumption for
  41  * another decade.
  42  */
  43 
  44 import java.util.concurrent.*;
  45 import java.util.concurrent.locks.*;
  46 import java.util.*;
  47 
  48 public final class TimeoutLockLoops {
  49     static final ExecutorService pool = Executors.newCachedThreadPool();
  50     static final LoopHelpers.SimpleRandom rng = new LoopHelpers.SimpleRandom();
  51     static boolean print = false;
  52     static final int ITERS = Integer.MAX_VALUE;
  53     static final long TIMEOUT = 100;
  54 
  55     public static void main(String[] args) throws Exception {
  56         int maxThreads = 100;
  57         if (args.length > 0)


< prev index next >