< prev index next >

test/jdk/java/util/concurrent/ConcurrentHashMap/MapLoops.java

Print this page

 31  * http://creativecommons.org/publicdomain/zero/1.0/
 32  */
 33 
 34 /*
 35  * @test
 36  * @bug 4486658
 37  * @summary Exercise multithreaded maps, by default ConcurrentHashMap.
 38  * Multithreaded hash table test.  Each thread does a random walk
 39  * though elements of "key" array. On each iteration, it checks if
 40  * table includes key.  If absent, with probability pinsert it
 41  * inserts it, and if present, with probability premove it removes
 42  * it.  (pinsert and premove are expressed as percentages to simplify
 43  * parsing from command line.)
 44  * @library /test/lib
 45  * @run main/timeout=1600 MapLoops
 46  */
 47 
 48 /*
 49  * @test
 50  * @summary Exercise multithreaded maps, using only heavy monitors.
 51  * @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64" | os.arch == "ppc64" | os.arch == "ppc64le"
 52  * @library /test/lib
 53  * @run main/othervm/timeout=1600 -XX:+IgnoreUnrecognizedVMOptions -XX:+UseHeavyMonitors -XX:+VerifyHeavyMonitors MapLoops
 54  */
 55 
 56 import static java.util.concurrent.TimeUnit.MILLISECONDS;
 57 
 58 import java.util.List;
 59 import java.util.Map;
 60 import java.util.SplittableRandom;
 61 import java.util.concurrent.CopyOnWriteArrayList;
 62 import java.util.concurrent.CyclicBarrier;
 63 import java.util.concurrent.ExecutorService;
 64 import java.util.concurrent.Executors;
 65 import jdk.test.lib.Utils;
 66 
 67 public class MapLoops {
 68     static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
 69     static int nkeys       = 1000; // 10_000
 70     static int pinsert     = 60;
 71     static int premove     = 2;

 31  * http://creativecommons.org/publicdomain/zero/1.0/
 32  */
 33 
 34 /*
 35  * @test
 36  * @bug 4486658
 37  * @summary Exercise multithreaded maps, by default ConcurrentHashMap.
 38  * Multithreaded hash table test.  Each thread does a random walk
 39  * though elements of "key" array. On each iteration, it checks if
 40  * table includes key.  If absent, with probability pinsert it
 41  * inserts it, and if present, with probability premove it removes
 42  * it.  (pinsert and premove are expressed as percentages to simplify
 43  * parsing from command line.)
 44  * @library /test/lib
 45  * @run main/timeout=1600 MapLoops
 46  */
 47 
 48 /*
 49  * @test
 50  * @summary Exercise multithreaded maps, using only heavy monitors.
 51  * @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64" | os.arch == "ppc64" | os.arch == "ppc64le" | os.arch == "riscv64"
 52  * @library /test/lib
 53  * @run main/othervm/timeout=1600 -XX:+IgnoreUnrecognizedVMOptions -XX:+UseHeavyMonitors -XX:+VerifyHeavyMonitors MapLoops
 54  */
 55 
 56 import static java.util.concurrent.TimeUnit.MILLISECONDS;
 57 
 58 import java.util.List;
 59 import java.util.Map;
 60 import java.util.SplittableRandom;
 61 import java.util.concurrent.CopyOnWriteArrayList;
 62 import java.util.concurrent.CyclicBarrier;
 63 import java.util.concurrent.ExecutorService;
 64 import java.util.concurrent.Executors;
 65 import jdk.test.lib.Utils;
 66 
 67 public class MapLoops {
 68     static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
 69     static int nkeys       = 1000; // 10_000
 70     static int pinsert     = 60;
 71     static int premove     = 2;
< prev index next >