Methods Summary |
---|
public void | execute()Check repeatedly for the specified conditions until they become
true or the timeout expires.
if (countConditions() > 1) {
throw new BuildException("You must not nest more than one "
+ "condition into "
+ getTaskName());
}
if (countConditions() < 1) {
throw new BuildException("You must nest a condition into "
+ getTaskName());
}
Condition c = (Condition) getConditions().nextElement();
long savedMaxWaitMillis = maxWaitMillis;
long savedCheckEveryMillis = checkEveryMillis;
try {
maxWaitMillis *= maxWaitMultiplier;
checkEveryMillis *= checkEveryMultiplier;
long start = System.currentTimeMillis();
long end = start + maxWaitMillis;
while (System.currentTimeMillis() < end) {
if (c.eval()) {
processSuccess();
return;
}
try {
Thread.sleep(checkEveryMillis);
} catch (InterruptedException e) {
// ignore
}
}
processTimeout();
} finally {
maxWaitMillis = savedMaxWaitMillis;
checkEveryMillis = savedCheckEveryMillis;
}
|
protected void | processSuccess()Actions to be taken on a successful waitfor.
This is an override point. The base implementation does nothing.
log(getTaskName() + ": condition was met", Project.MSG_VERBOSE);
|
protected void | processTimeout()Actions to be taken on an unsuccessful wait.
This is an override point. It is where the timeout processing takes place.
The base implementation sets the timeoutproperty if there was a timeout
and the property was defined.
log(getTaskName() + ": timeout", Project.MSG_VERBOSE);
if (timeoutProperty != null) {
getProject().setNewProperty(timeoutProperty, "true");
}
|
public void | setCheckEvery(long time)Set the time between each check
checkEveryMillis = time;
|
public void | setCheckEveryUnit(org.apache.tools.ant.taskdefs.WaitFor$Unit unit)Set the check every time unit
checkEveryMultiplier = unit.getMultiplier();
|
public void | setMaxWait(long time)Set the maximum length of time to wait.
maxWaitMillis = time;
|
public void | setMaxWaitUnit(org.apache.tools.ant.taskdefs.WaitFor$Unit unit)Set the max wait time unit
maxWaitMultiplier = unit.getMultiplier();
|
public void | setTimeoutProperty(java.lang.String p)Name the property to set after a timeout.
timeoutProperty = p;
|