Waitfor
Description
Blocks execution until a set of specified conditions become true. This is intended
to be used with the parallel task to
synchronize a set of processes.
The conditions to wait for are defined in nested elements,
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
Attribute |
Description |
Required |
maxwait |
The maximum amount of time to wait for all the required conditions
to become true before failing the task. Defaults to 180000 maxwaitunits. |
No |
maxwaitunit |
The unit of time that must be used to interpret the value of the
maxwait attribute. Defaults to millisecond.
Valid Values are
- millisecond
- second
- minute
- hour
- day
- week
|
No |
checkevery |
The amount of time to wait between each test of the conditions.
Defaults to 500 checkeveryunits. |
No |
checkeveryunit |
The unit of time that must be used to interpret the value of the
checkevery attribute. Defaults to millisecond.
Valid Values are
- millisecond
- second
- minute
- hour
- day
- week
|
No |
timeoutproperty |
the name of the property to set if maxwait has
been exceeded. |
No |
The available conditions that satisfy the
<waitfor> task are the same as those for the
<condition> task. See
here for the full list.
Examples
<waitfor maxwait="30" maxwaitunit="second">
<available file="errors.log"/>
</waitfor>
waits up to 30 seconds for a file called errors.log to appear.
<waitfor maxwait="3" maxwaitunit="minute" checkevery="500">
<http url="http://localhost/myapp/index.html"/>
</waitfor>
waits up to 3 minutes (and checks every 500 milliseconds) for a web server on localhost
to serve up the specified URL.
<waitfor maxwait="10" maxwait="second">
<and>
<socket server="dbserver" port="1521"/>
<http url="http://webserver/mypage.html"/>
</and>
</waitfor>
waits up to 10 seconds for a server on the dbserver machine to begin listening
on port 1521 and for the http://webserver/mypage.html web page
to become available.
Copyright © 2001 Apache Software Foundation. All rights
Reserved.
|