< prev index next >

test/hotspot/jtreg/vmTestbase/gc/gctests/gctest02/gctest02.java

Print this page
rev 59093 : [mq]: randomness-code_vmTestbase_gc

*** 38,47 **** --- 38,49 ---- package gc.gctests.gctest02; import nsk.share.TestFailure; import nsk.share.TestBug; + import nsk.share.test.LocalRandom; + /* stress testing create 16 memory evil threads requesting to allocate the object of sizes from 8 to ( 2 ^ 19). The live time of objects is random (0 ~ 1000). Here we let the threads that reference the objects
*** 53,76 **** class PopulationException extends Exception { //this exception is used to signal that we've //reached the end of the test } - //the LocalRandom class is used to isolate the pseudo-random - //number generator from other parts of the system which might - //silently be using it. - //This is to make sure the tests are repeatable - - class LocalRandom { - public static Random rGen = null; - - public static double random() { - //should fail if rGen is not initialized - return rGen.nextDouble(); - } - } - class ThreadCount { static int count= 0; static synchronized void inc() { count++; } static synchronized void dec() { count --; } static synchronized int get() { return count; } --- 55,64 ----
*** 188,198 **** public class gctest02 { public static void main(String args[] ) { int bufsz = 8; int peopleLimit = 1000; - long randomSeed = System.currentTimeMillis(); Memevil me=null; if (args.length > 0) { try { --- 176,185 ----
*** 204,231 **** "Bad input to gctest02. Expected integer, got: ->" + args[0] + "<-", e); } } - if (args.length == 2) - { - try - { - randomSeed = new Long(args[1]).longValue(); - } - catch (NumberFormatException e) - { - throw new TestBug( - "Bad input to gctest02. Expected long, got: ->" - + args[0] + "<-", e); - } - } Person.setPopulationLimit(peopleLimit); - System.out.println("Seed value: " + randomSeed); for (int ii=0; ii<40; ii++) { bufsz = 8; - LocalRandom.rGen = new Random(randomSeed); Person.populationCount = 0; Escaper you = new Escaper(); you.setName("Escaper"); ThreadCount.inc(); you.start(); --- 191,203 ----
< prev index next >