}
if (countConditions() < 1) {
throw new BuildException("You must nest a condition into "
+ getTaskName());
}
Condition c = (Condition) getConditions().nextElement();
try {
long maxWaitMillis = calculateMaxWaitMillis();
long checkEveryMillis = calculateCheckEveryMillis();
long start = System.currentTimeMillis();
long end = start + maxWaitMillis;
while (System.currentTimeMillis() < end) {
if (c.eval()) {
processSuccess();
return;
}
Thread.sleep(checkEveryMillis);
}