ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Koss <m.k...@open.ac.uk>
Subject Re: Task.init() called twice ?
Date Tue, 25 Jun 2002 16:05:17 GMT
On Tuesday 25 June 2002 3:45 pm, Conor MacNeill wrote:
> 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

Thank you for your answer.
I have seen the life-cycle, but I wasn't sure what does the "parser-time" mean 
exactly and how many instances get created.

Cheers

Matt


-- 
Matt Koss
Knowledge Media Institute
Open University
e-mail: m.koss@open.ac.uk

--
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