try {
start.await();
for (int i = 0; i < 100; i++) {
int buildNumber = -1, savedBuildNumber = -1;
TextFile f;
synchronized (p) {
if (assign) {
buildNumber = p.assignBuildNumber();
f = p.getNextBuildNumberFile();
if (f == null) {
this.message = "Could not get build number file";
this.passed = false;
return;
}
savedBuildNumber = Integer.parseInt(f.readTrim());
if (buildNumber != (savedBuildNumber-1)) {
this.message = "Build numbers don't match (" + buildNumber + ", " + (savedBuildNumber-1) + ")";
this.passed = false;
return;
}
} else {
buildNumber = p.getNextBuildNumber() + 100;
p.updateNextBuildNumber(buildNumber);
f = p.getNextBuildNumberFile();
if (f == null) {
this.message = "Could not get build number file";
this.passed = false;
return;
}
savedBuildNumber = Integer.parseInt(f.readTrim());
if (buildNumber != savedBuildNumber) {
this.message = "Build numbers don't match (" + buildNumber + ", " + savedBuildNumber + ")";
this.passed = false;
return;
}