2728293031323334353637
try { synchronized (map) { ++ counter[0]; map.notifyAll(); while (exception[0] == null && step[0] == 0) { map.wait(); } } for (int i = 0; i < IterationCount; ++i) { populateCommon(map);
4041424344454647484950
synchronized (map) { -- counter[0]; map.notifyAll(); while (exception[0] == null && step[0] == 1) { map.wait(); } } for (int i = 0; i < IterationCount; ++i) { populate(map, index * Range);
6667686970717273747576
}.start(); } try { while (exception[0] == null && counter[0] < ThreadCount) { map.wait(); } step[0] = 1; map.notifyAll();
7374757677787980818283
step[0] = 1; map.notifyAll(); while (exception[0] == null && counter[0] > 0) { map.wait(); } if (map.size() != ThreadCount * Range) { System.err.println ("expected " + (ThreadCount * Range) + " got " + map.size());
8990919293949596979899
step[0] = 2; map.notifyAll(); while (exception[0] == null && counter[0] < ThreadCount) { map.wait(); } expect(map.isEmpty()); expect(exception[0] == null); } catch (Throwable e) {