diff --git a/docs/manual/CoreTasks/waitfor.html b/docs/manual/CoreTasks/waitfor.html index 9de82c887..0fb570663 100644 --- a/docs/manual/CoreTasks/waitfor.html +++ b/docs/manual/CoreTasks/waitfor.html @@ -16,6 +16,9 @@ if multiple conditions are specified, then the task will wait until all conditions are true..

If both maxwait and maxwaitunit are not specified, the maxwait is 3 minutes (180000 milliseconds).

+

If the timeoutproperty attribute has been set, a +property of that name will be created if the condition didn't come +true within the specified time.

Parameters

@@ -67,6 +70,12 @@ if multiple conditions are specified, then the task will wait until all conditio + + + + +
No
timeoutpropertythe name of the property to set if maxwait has + been exceeded.No

Nested Elements

diff --git a/src/main/org/apache/tools/ant/taskdefs/WaitFor.java b/src/main/org/apache/tools/ant/taskdefs/WaitFor.java index d88b43487..4447e7dd6 100644 --- a/src/main/org/apache/tools/ant/taskdefs/WaitFor.java +++ b/src/main/org/apache/tools/ant/taskdefs/WaitFor.java @@ -74,6 +74,7 @@ import java.util.Hashtable; *
  • maxwaitunit - The unit to be used to interpret maxwait attribute
  • *
  • checkevery - amount of time to sleep between each check
  • *
  • checkeveryunit - The unit to be used to interpret checkevery attribute
  • + *
  • timeoutproperty - name of a property to set if maxwait has been exceeded.
  • * * * The maxwaitunit and checkeveryunit are allowed to have the following values: @@ -88,6 +89,7 @@ public class WaitFor extends ConditionBase { private long maxWaitMultiplier = 1l; private long checkEveryMillis = 500l; private long checkEveryMultiplier = 1l; + private String timeoutProperty; /** * Set the maximum length of time to wait @@ -117,6 +119,13 @@ public class WaitFor extends ConditionBase { checkEveryMultiplier = unit.getMultiplier(); } + /** + * Set the timeout property. + */ + public void setTimeoutProperty(String p) { + timeoutProperty = p; + } + /** * Check repeatedly for the specified conditions until they become * true or the timeout expires. @@ -145,7 +154,9 @@ public class WaitFor extends ConditionBase { } } - throw new BuildException("Task did not complete in time"); + if (timeoutProperty != null) { + project.setNewProperty(timeoutProperty, "true"); + } } public static class Unit extends EnumeratedAttribute {