ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Conor MacNeill <co...@cortexebusiness.com.au>
Subject Re: Task.init() called twice ?
Date Tue, 25 Jun 2002 14:45:17 GMT
Matt Koss wrote:
> I am trying to understand the execution loop of the task.
> 
> I have written a custom task and I have put the initialisation code inside of 
> the init() method.
> I thought that init() method is called only once ( for taskdef ) and that 
> execute() method is then called for each occurence of the custom task.
> 
> However, init() method is called for each occurence of my task.
> Is this the correct behaviour ?
> 

This is correct. Taskdef does not create an instance of your task. It 
creates a mapping from a taskname to a Java class. There will be a new 
instance of your custom task for each instance in the XML.

Check out the following link for the lifecyle of a task and when init() is 
called relative to execute().

http://jakarta.apache.org/ant/manual/develop.html#writingowntask

Conor



--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message