Print this page


Split Close
Expand all
Collapse all
          --- old/test/java/util/concurrent/locks/ReentrantReadWriteLock/MapLoops.java
          +++ new/test/java/util/concurrent/locks/ReentrantReadWriteLock/MapLoops.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 MapLoops.java
       37 + * @compile -source 1.5 MapLoops.java
  38   38   * @run main/timeout=4700 MapLoops
  39   39   * @summary Exercise multithreaded maps, by default ConcurrentHashMap.
  40   40   * Multithreaded hash table test.  Each thread does a random walk
  41   41   * though elements of "key" array. On each iteration, it checks if
  42   42   * table includes key.  If absent, with probability pinsert it
  43   43   * inserts it, and if present, with probability premove it removes
  44   44   * it.  (pinsert and premove are expressed as percentages to simplify
  45   45   * parsing from command line.)
  46   46   */
  47   47  
↓ open down ↓ 10 lines elided ↑ open up ↑
  58   58      static int insertsPerMaxRandom;
  59   59  
  60   60      static final ExecutorService pool = Executors.newCachedThreadPool();
  61   61  
  62   62      public static void main(String[] args) throws Exception {
  63   63  
  64   64          Class mapClass = null;
  65   65          if (args.length > 0) {
  66   66              try {
  67   67                  mapClass = Class.forName(args[0]);
  68      -            } catch(ClassNotFoundException e) {
       68 +            } catch (ClassNotFoundException e) {
  69   69                  throw new RuntimeException("Class " + args[0] + " not found.");
  70   70              }
  71   71          }
  72   72          else
  73   73              mapClass = RWMap.class;
  74   74  
  75   75          if (args.length > 1)
  76   76              maxThreads = Integer.parseInt(args[1]);
  77   77  
  78   78          if (args.length > 2)
↓ open down ↓ 112 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX