You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

waitfor.html 4.9 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <!--
  2. Licensed to the Apache Software Foundation (ASF) under one or more
  3. contributor license agreements. See the NOTICE file distributed with
  4. this work for additional information regarding copyright ownership.
  5. The ASF licenses this file to You under the Apache License, Version 2.0
  6. (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. -->
  15. <html>
  16. <head>
  17. <meta http-equiv="Content-Language" content="en-us">
  18. <link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
  19. <title>WaitFor Task</title>
  20. </head>
  21. <body>
  22. <h2>Waitfor</h2>
  23. <h3>Description</h3>
  24. <p>Blocks execution until a set of specified conditions become true. This is intended
  25. to be used with the <a href="parallel.html">parallel</a> task to
  26. synchronize a set of processes.</p>
  27. <p>The conditions to wait for are defined in <a href="waitfor.html#nested">nested elements</a>,
  28. if multiple conditions are specified, then the task will wait until all conditions are true..</p>
  29. <p></p>
  30. <p>If both maxwait and maxwaitunit are not specified, the maxwait is 3 minutes (180000 milliseconds).</p>
  31. <p>If the <code>timeoutproperty</code> attribute has been set, a
  32. property of that name will be created if the condition didn't come
  33. true within the specified time.</p>
  34. <h3>Parameters</h3>
  35. <table border="1" cellpadding="2" cellspacing="0">
  36. <tr>
  37. <td valign="top"><b>Attribute</b></td>
  38. <td valign="top"><b>Description</b></td>
  39. <td align="center" valign="top"><b>Required</b></td>
  40. </tr>
  41. <tr>
  42. <td valign="top">maxwait</td>
  43. <td valign="top">The maximum amount of time to wait for all the required conditions
  44. to become true before failing the task. Defaults to 180000 maxwaitunits.</td>
  45. <td valign="top" align="center">No</td>
  46. </tr>
  47. <tr>
  48. <td valign="top">maxwaitunit</td>
  49. <td valign="top">The unit of time that must be used to interpret the value of the
  50. maxwait attribute. Defaults to millisecond.
  51. Valid Values are
  52. <ul>
  53. <li>millisecond</li>
  54. <li>second</li>
  55. <li>minute</li>
  56. <li>hour</li>
  57. <li>day</li>
  58. <li>week</li>
  59. </ul>
  60. </td>
  61. <td valign="top" align="center">No</td>
  62. </tr>
  63. <tr>
  64. <td valign="top">checkevery</td>
  65. <td valign="top">The amount of time to wait between each test of the conditions.
  66. Defaults to 500 checkeveryunits.</td>
  67. <td valign="top" align="center">No</td>
  68. </tr>
  69. <tr>
  70. <td valign="top">checkeveryunit</td>
  71. <td valign="top">The unit of time that must be used to interpret the value of the
  72. checkevery attribute. Defaults to millisecond.
  73. Valid Values are
  74. <ul>
  75. <li>millisecond</li>
  76. <li>second</li>
  77. <li>minute</li>
  78. <li>hour</li>
  79. <li>day</li>
  80. <li>week</li>
  81. </ul>
  82. </td>
  83. <td valign="top" align="center">No</td>
  84. </tr>
  85. <tr>
  86. <td valign="top">timeoutproperty</td>
  87. <td valign="top">the name of the property to set if maxwait has
  88. been exceeded.</td>
  89. <td valign="top" align="center">No</td>
  90. </tr>
  91. </table>
  92. <h3><a name="nested">Nested Elements</a></h3>
  93. <p>The available conditions that satisfy the
  94. <code>&lt;waitfor&gt;</code> task are the same as those for the
  95. <a href="condition.html"><code>&lt;condition&gt;</code></a> task. See
  96. <a href="conditions.html">here</a> for the full list.</p>
  97. <h3>Examples</h3>
  98. <blockquote><pre>
  99. &lt;waitfor maxwait="30" maxwaitunit="second"&gt;
  100. &lt;available file="errors.log"/&gt;
  101. &lt;/waitfor&gt;
  102. </pre></blockquote>
  103. <p>waits up to 30 seconds for a file called errors.log to appear.</p>
  104. <blockquote><pre>
  105. &lt;waitfor maxwait="3" maxwaitunit="minute" checkevery="500"&gt;
  106. &lt;http url="http://localhost/myapp/index.html"/&gt;
  107. &lt;/waitfor&gt;
  108. </pre></blockquote>
  109. <p>waits up to 3 minutes (and checks every 500 milliseconds) for a web server on localhost
  110. to serve up the specified URL.</p>
  111. <blockquote><pre>
  112. &lt;waitfor maxwait="10" maxwaitunit="second"&gt;
  113. &lt;and&gt;
  114. &lt;socket server="dbserver" port="1521"/&gt;
  115. &lt;http url="http://webserver/mypage.html"/&gt;
  116. &lt;/and&gt;
  117. &lt;/waitfor&gt;
  118. </pre></blockquote>
  119. <p>waits up to 10 seconds for a server on the dbserver machine to begin listening
  120. on port 1521 and for the http://webserver/mypage.html web page
  121. to become available.</p>
  122. </body>
  123. </html>