java left logo
java middle logo
java right logo
 

Home arrow Other API Tips
 
 
Main Menu
Home
Java Tutorials
Book Reviews
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Java Network
Java Forums
Java Blog




Most Visited Tips
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Book Reviews
Top Rated Tips
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Book Reviews


Statistics
Registered Users: 4084
Java SE Tips: 614
Java ME Tips: 202
Java EE Tips: 183
Other API Tips: 779
Java Applications: 298
Java Libraries: 209
Java Games: 16
Book Reviews:
 
 
 
How to use Waitfor task E-mail
User Rating: / 4
PoorBest 

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

Nested Elements

The available conditions that satisfy the <waitfor> task are the same as those for the <condition> task.

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.

Source: Apache Ant


 Related Tips

 
< Prev   Next >

Page 1 of 0 ( 0 comments )

You can share your information about this topic using the form below!

Please do not post your questions with this form! Thanks.


Name (required)


E-Mail (required)

Your email will not be displayed on the site - only to our administrator
Homepage(optional)



Comment Enable HTML code : Yes No



 
       
         
     
 
 
 
   
 
 
java bottom left
java bottom middle
java bottom right
RSS 0.91 FeedRSS 1.0 FeedRSS 2.0 FeedATOM FeedOPML Feed

Home - About Us - Privacy Policy
Copyright 2005 - 2008 www.java-tips.org
Java is a trademark of Sun Microsystems, Inc.