public void test_singleResourceLocking_serialized_waitsFor_lowConcurrency5_withTaskDeath() throws Exception {
  final Properties properties=new Properties();
  final int nthreads=3;
  final int ntasks=100;
  final double percentTaskDeath=.1d;
  final double expectedErrorRate=percentTaskDeath;
  properties.setProperty(TestOptions.CORE_POOL_SIZE,"" + nthreads);
  properties.setProperty(TestOptions.NTASKS,"" + ntasks);
  properties.setProperty(TestOptions.NRESOURCES,"1");
  properties.setProperty(TestOptions.MIN_LOCKS,"1");
  properties.setProperty(TestOptions.MAX_LOCKS,"1");
  properties.setProperty(TestOptions.PREDECLARE_LOCKS,"false");
  properties.setProperty(TestOptions.SORT_LOCK_REQUESTS,"false");
  properties.setProperty(TestOptions.PERCENT_TASK_DEATH,"" + percentTaskDeath);
  final Result result=doComparisonTest(properties);
  assertEquals("maxrunning",1,Integer.parseInt(result.get("maxrunning")));
  assertEquals("ndeadlock",0,Integer.parseInt(result.get("ndeadlock")));
  final int nsuccess=Integer.parseInt(result.get("nsuccess"));
  final int nhorriddeath=Integer.parseInt(result.get("nhorriddeath"));
  assertEquals(ntasks,nsuccess + nhorriddeath);
  final double actualErrorRate=nhorriddeath / (double)ntasks;
  if ((actualErrorRate < expectedErrorRate - .1) || (actualErrorRate > expectedErrorRate + .1)) {
    fail("error rate: expected=" + expectedErrorRate + ", actual="+ actualErrorRate);
  }
}

public void test_singleResourceLocking_serialized_waitsFor_lowConcurrency5_withTaskDeath ( ) throws Exception { final Properties properties = new Properties ( ) ; final int nthreads = 3 ; final int ntasks = 100 ; final double percentTaskDeath = .1d ; final double expectedErrorRate = percentTaskDeath ; properties . setProperty ( TestOptions . CORE_POOL_SIZE , "" + nthreads ) ; properties . setProperty ( TestOptions . NTASKS , "" + ntasks ) ; properties . setProperty ( TestOptions . NRESOURCES , "1" ) ; properties . setProperty ( TestOptions . MIN_LOCKS , "1" ) ; properties . setProperty ( TestOptions . MAX_LOCKS , "1" ) ; properties . setProperty ( TestOptions . PREDECLARE_LOCKS , "false" ) ; properties . setProperty ( TestOptions . SORT_LOCK_REQUESTS , "false" ) ; properties . setProperty ( TestOptions . PERCENT_TASK_DEATH , "" + percentTaskDeath ) ; final Result result = doComparisonTest ( properties ) ; assertEquals ( "maxrunning" , 1 , Integer . parseInt ( result . get ( "maxrunning" ) ) ) ; assertEquals ( "ndeadlock" , 0 , Integer . parseInt ( result . get ( "ndeadlock" ) ) ) ; final int nsuccess = Integer . parseInt ( result . get ( "nsuccess" ) ) ; final int nhorriddeath = Integer . parseInt ( result . get ( "nhorriddeath" ) ) ; assertEquals ( ntasks , nsuccess + nhorriddeath ) ; final double actualErrorRate = nhorriddeath / ( double ) ntasks ; if ( ( actualErrorRate < expectedErrorRate - .1 ) || ( actualErrorRate > expectedErrorRate + .1 ) ) { fail ( "error rate: expected=" + expectedErrorRate + ", actual=" + actualErrorRate ) ; } }
test where each operation locks only a single resource and there is only one resource to be locked so that all operations must be serialized and where 10 % of all tasks die a horrid death .
