1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280
|
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>
Chapter 10. Limit</title>
<meta content="DocBook XSL Stylesheets V1.60.1" name="generator">
<link rel="home" href="index.html" title="Antelope Users Guide">
<link rel="up" href="bk03.html" title="Additional Ant Tasks">
<link rel="previous" href="bk03ch09.html" title="Chapter 9. Stopwatch">
<link rel="next" href="bk03ch11.html" title="Chapter 11. Math">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<div class="chapter" lang="en">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="Limit">
</a>
Limit</h2>
</div>
</div>
<div>
</div>
</div>
<p>
The Limit task is a task container (that is, it holds other tasks) and sets a time limit on how long the nested tasks are allowed to run. This is useful for unit tests that go awry, hung socket connections, or other potentially long running tasks that need to be shut off without stopping the build.
</p>
<p>
<div class="table">
<a name="N1096A">
</a>
<p class="title">
<b>
Table 10.1. Limit Task Attributes</b>
</p>
<table summary="Limit Task Attributes" border="1">
<colgroup>
<col>
<col>
<col>
<col>
</colgroup>
<thead>
<tr>
<th>
Attribute</th>
<th>
Description</th>
<th>
Default</th>
<th>
Required</th>
</tr>
</thead>
<tbody>
<tr>
<td>
maxwait</td>
<td>
How long to wait for nested tasks to finish.</td>
<td>
180 seconds (3 minutes)</td>
<td>
No</td>
</tr>
<tr>
<td>
maxwaitunit</td>
<td>
The unit for maxwait. Valid values are "millisecond", "second", "minute", "hour", "day", "week".</td>
<td>
seconds</td>
<td>
No</td>
</tr>
<tr>
<td>
failonerror</td>
<td>
Should the build fail if the time limit has been exceeded?</td>
<td>
false</td>
<td>
No</td>
</tr>
<tr>
<td>
property</td>
<td>
The name of a property to set if the max wait time is exceeded.</td>
<td>
none</td>
<td>
No</td>
</tr>
<tr>
<td>
value</td>
<td>
The value to set for the property if the max wait time is exceeded.</td>
<td>
true</td>
<td>
No</td>
</tr>
<tr>
<td>
milliseconds</td>
<td>
How long to wait in milliseconds.</td>
<td>
3 minutes</td>
<td>
No</td>
</tr>
<tr>
<td>
seconds</td>
<td>
How long to wait in seconds.</td>
<td>
3 minutes</td>
<td>
No</td>
</tr>
<tr>
<td>
minutes</td>
<td>
How long to wait in minutes.</td>
<td>
3 minutes</td>
<td>
No</td>
</tr>
<tr>
<td>
hours</td>
<td>
How long to wait in hours.</td>
<td>
3 minutes</td>
<td>
No</td>
</tr>
<tr>
<td>
days</td>
<td>
How long to wait in days.</td>
<td>
3 minutes</td>
<td>
No</td>
</tr>
<tr>
<td>
weeks</td>
<td>
How long to wait in weeks.</td>
<td>
3 minutes</td>
<td>
No</td>
</tr>
</tbody>
</table>
</div>
</p>
<p>
Examples:
</p>
<p>
Neither the echo nor the fail will happen in this example. The build will continue once the time has expired.
<table border="0" bgcolor="#E0E0E0">
<tr>
<td>
<pre class="programlisting">
<limit maxwait="3">
<sleep seconds="10"/>
<echo>This won't happen...</echo>
<fail>This won't happen either...</fail>
</limit>
</pre>
</td>
</tr>
</table>
</p>
<p>
This is identical to the above example, but uses the convenience "seconds" attribute:
<table border="0" bgcolor="#E0E0E0">
<tr>
<td>
<pre class="programlisting">
<limit seconds="3">
<sleep seconds="10"/>
<echo>This won't happen...</echo>
<fail>This won't happen either...</fail>
</limit>
</pre>
</td>
</tr>
</table>
</p>
<p>
Neither the echo nor the fail will happen in this example. The build will not continue once the time has expired.
<table border="0" bgcolor="#E0E0E0">
<tr>
<td>
<pre class="programlisting">
<limit maxwait="3" failonerror="true">
<sleep seconds="10"/>
<echo>This won't happen...</echo>
<fail>This won't happen either...</fail>
</limit>
</pre>
</td>
</tr>
</table>
</p>
<p>
The limit will be reached and a property will be set indicating so.
<table border="0" bgcolor="#E0E0E0">
<tr>
<td>
<pre class="programlisting">
<limit minutes="3" property="limit_reached">
<sleep minutes="10"/>
<echo>This won't happen...</echo>
<fail>This won't happen either...</fail>
</limit>
<echo>limit_reached = ${limit_reached)</echo>
</pre>
</td>
</tr>
</table>
</p>
</div>
<hr>
<p align="center">Copyright © 2003-2004 Ant-Contrib Project. All
rights Reserved.</p>
</body>
</html>
|