Print this page


Split Close
Expand all
Collapse all
          --- old/test/java/util/concurrent/ConcurrentHashMap/MapLoops.java
          +++ new/test/java/util/concurrent/ConcurrentHashMap/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=1600 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 ↓ 170 lines elided ↑ open up ↑
 218  218  
 219  219          public void run() {
 220  220              try {
 221  221                  barrier.await();
 222  222                  int ops = nops;
 223  223                  while (ops > 0)
 224  224                      ops -= step();
 225  225                  barrier.await();
 226  226              }
 227  227              catch (Throwable throwable) {
 228      -                synchronized(System.err) {
      228 +                synchronized (System.err) {
 229  229                      System.err.println("--------------------------------");
 230  230                      throwable.printStackTrace();
 231  231                  }
 232  232                  throwables.add(throwable);
 233  233              }
 234  234          }
 235  235      }
 236  236  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX