ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Rice <>
Subject <timer /> task created
Date Wed, 18 Feb 2004 20:47:01 GMT
I recently created a <timer /> task, for limiting the execution time of a 
series of nested tasks.   

Why did I create such a thing?  In my case, I 
utilize ant to perform a number of lengthy ftp and http get's against a 
long list of files.  At times, these processes will "hang".  In other 
words, not complete in a timely fashion and not fail.  I wanted to be able 
to limit this behavior.

I thought I would ping this list to see if such a task is useful to other 
users, possibly ( hopefully ) for completely different reasons.  If it 
proves useful, how do I contribute this new ( non patch ) code?  Further 
class details are included below.

Robert Rice

Here are more specifics about the <timer /> class:

This class is designed to limit the maximum execution time for a series of 
tasks. This limit is the total time allowed for all contained tasks.

The following exit strategies are provided by the timer task:

    * If the time limit is reached, the current task will be interrupted 
and no more contained tasks will be executed.
    * If a BuildException is thrown by the current task, no more contained 
tasks will be executed.
    * The timer task will exit normally if all contained tasks complete 
execution prior to the maximum time limit.

This class utilizes the Unit EnumeratedAttribute of the <waitfor /> task. 
This was 
done to share a bit of the timer functionality plus adhere to its 
attribute naming conventions. In a way, this class is somewhat of a 
combination of the <waitfor /> task and the <sequential />task. This task 
can be used in conjunction 
with <parallel /> and <sequential /> tasks.

The following attributes can be specified on a timer task:

    * maxwait - maximum length of time to wait before giving up
    * maxwaitunit - The unit to be used to interpret maxwait attribute
    * timeoutproperty - name of a property to set if maxwait has been 

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message