Print this page


Split Close
Expand all
Collapse all
          --- old/test/java/util/concurrent/locks/ReentrantLock/CancelledLockLoops.java
          +++ new/test/java/util/concurrent/locks/ReentrantLock/CancelledLockLoops.java
↓ open down ↓ 26 lines elided ↑ open up ↑
  27   27   * file:
  28   28   *
  29   29   * Written by Doug Lea with assistance from members of JCP JSR-166
  30   30   * Expert Group and released to the public domain, as explained at
  31   31   * http://creativecommons.org/licenses/publicdomain
  32   32   */
  33   33  
  34   34  /*
  35   35   * @test
  36   36   * @bug 4486658
  37      - * @compile CancelledLockLoops.java
       37 + * @compile -source 1.5 CancelledLockLoops.java
  38   38   * @run main/timeout=2800 CancelledLockLoops
  39   39   * @summary tests lockInterruptibly.
  40   40   * Checks for responsiveness of locks to interrupts. Runs under that
  41   41   * assumption that ITERS_VALUE computations require more than TIMEOUT
  42   42   * msecs to complete.
  43   43   */
  44   44  
  45   45  import java.util.concurrent.*;
  46   46  import java.util.concurrent.locks.*;
  47   47  import java.util.*;
↓ open down ↓ 9 lines elided ↑ open up ↑
  57   57          if (args.length > 0)
  58   58              maxThreads = Integer.parseInt(args[0]);
  59   59  
  60   60          print = true;
  61   61  
  62   62          for (int i = 2; i <= maxThreads; i += (i+1) >>> 1) {
  63   63              System.out.print("Threads: " + i);
  64   64              try {
  65   65                  new ReentrantLockLoop(i).test();
  66   66              }
  67      -            catch(BrokenBarrierException bb) {
       67 +            catch (BrokenBarrierException bb) {
  68   68                  // OK, ignore
  69   69              }
  70   70              Thread.sleep(TIMEOUT);
  71   71          }
  72   72      }
  73   73  
  74   74      static final class ReentrantLockLoop implements Runnable {
  75   75          private int v = rng.nextInt();
  76   76          private int completed;
  77   77          private volatile int result = 17;
↓ open down ↓ 89 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX