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.4 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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 to be used
  25. with the <a href="parallel.html">parallel</a> task to synchronize a set of processes.</p>
  26. <p>The conditions to wait for are defined in <a href="waitfor.html#nested">nested elements</a>, if
  27. multiple conditions are specified, then the task will wait until all conditions are true.</p>
  28. <p>If both <var>maxwait</var> and <var>maxwaitunit</var> are not specified,
  29. default <var>maxwait</var> is 3 minutes (180000 milliseconds).</p>
  30. <p>If the <var>timeoutproperty</var> attribute has been set, a property of that name will be created
  31. if the condition didn't come true within the specified time.</p>
  32. <h3>Parameters</h3>
  33. <table class="attr">
  34. <tr>
  35. <th>Attribute</th>
  36. <th>Description</th>
  37. <th>Required</th>
  38. </tr>
  39. <tr>
  40. <td>maxwait</td>
  41. <td>The maximum amount of time to wait for all the required conditions to become true before
  42. failing the task.</td>
  43. <td>No; defaults to 180000 <var>maxwaitunit</var>s</td>
  44. </tr>
  45. <tr>
  46. <td>maxwaitunit</td>
  47. <td>The unit of time that must be used to interpret the value of the <var>maxwait</var>
  48. attribute. Valid values are
  49. <ul>
  50. <li><q>millisecond</q></li>
  51. <li><q>second</q></li>
  52. <li><q>minute</q></li>
  53. <li><q>hour</q></li>
  54. <li><q>day</q></li>
  55. <li><q>week</q></li>
  56. </ul>
  57. </td>
  58. <td>No; defaults to <q>millisecond</q></td>
  59. </tr>
  60. <tr>
  61. <td>checkevery</td>
  62. <td>The amount of time to wait between each test of the conditions.</td>
  63. <td>No; defaults to 500 <var>checkeveryunit</var>s</td>
  64. </tr>
  65. <tr>
  66. <td>checkeveryunit</td>
  67. <td>The unit of time that must be used to interpret the value of the <var>checkevery</var>
  68. attribute. Valid values are
  69. <ul>
  70. <li><q>millisecond</q></li>
  71. <li><q>second</q></li>
  72. <li><q>minute</q></li>
  73. <li><q>hour</q></li>
  74. <li><q>day</q></li>
  75. <li><q>week</q></li>
  76. </ul>
  77. </td>
  78. <td>No; defaults to <q>millisecond</q></td>
  79. </tr>
  80. <tr>
  81. <td>timeoutproperty</td>
  82. <td>the name of the property to set if <var>maxwait</var> has been exceeded.</td>
  83. <td>No</td>
  84. </tr>
  85. </table>
  86. <h3 id="nested">Parameters specified as nested elements</h3>
  87. <p>The available conditions that satisfy the <code>&lt;waitfor&gt;</code> task are the same as those
  88. for the <a href="condition.html"><code>&lt;condition&gt;</code></a>
  89. task. See <a href="conditions.html">here</a> for the full list.</p>
  90. <h3>Examples</h3>
  91. <pre>
  92. &lt;waitfor maxwait="30" maxwaitunit="second"&gt;
  93. &lt;available file="errors.log"/&gt;
  94. &lt;/waitfor&gt;</pre>
  95. <p>waits up to 30 seconds for a file called <samp>errors.log</samp> to appear.</p>
  96. <pre>
  97. &lt;waitfor maxwait="3" maxwaitunit="minute" checkevery="500"&gt;
  98. &lt;http url="http://localhost/myapp/index.html"/&gt;
  99. &lt;/waitfor&gt;</pre>
  100. <p>waits up to 3 minutes (and checks every 500 milliseconds) for a web server
  101. on <samp>localhost</samp> to serve up the specified URL.</p>
  102. <pre>
  103. &lt;waitfor maxwait="10" maxwaitunit="second"&gt;
  104. &lt;and&gt;
  105. &lt;socket server="dbserver" port="1521"/&gt;
  106. &lt;http url="http://webserver/mypage.html"/&gt;
  107. &lt;/and&gt;
  108. &lt;/waitfor&gt;</pre>
  109. <p>waits up to 10 seconds for a server on the <samp>dbserver</samp> machine to begin listening on
  110. port 1521 and for the <samp>http://webserver/mypage.html</samp> web page to become available.</p>
  111. </body>
  112. </html>