The reason the refernces to created tasks is an accidental consequence
of the implementation of UnknownElement and RuntimeConfigurable.
It is difficult to remove the reference without telling UnknownElement
in Target#execute and Seqential#execute that the reference can be
removed.
Peter
Jose Alberto Fernandez wrote:
I think the two ways of reusing tasks that you point below
are fair usage, however that do not answer my question about
<ant[call]/>.
For the issue of reusability itself, let me point how I think it
should work on the cases you mentioned:
(1) If one IDs a task, we are really setting the ID on the
UnknownObject(?) since we cannot resolve it at parsing time.
So when a script accesses the reference the resolution process
will create the actual task instance. As long as the script keeps
the actual task, well it will not be reclaimed. But if the
reference is acessed on the project instance again, then you should get
a new task (i.e., UnknownObject should not keep internal references,
it should be stateless).
(2) If your java task creates another task directly and uses it,
well it is upto you to make sure you dispose of it when you are
finish with it (i.e., do not keep it in some static table forever),
whether a task is design to be executed multiple times or not
is part of the task behaviour and is a separate issue.
My point is that ANT itself should not be keeping around
objects that it will not access again. I guess I am suggesting
to stop having resolved tasks and unresolve UnknownObjects as part
of the project tree, and instead have UnknownObjects all across.
It is really our DOM tree after all.
From: Dominique Devienne [mailto:[EMAIL PROTECTED]
I can see two ways for a task to be reused:
1) thru the controversial use of IDs on tasks,
which can then be executed by <script>s.
2) thru custom tasks that compose/execute several
time the same task. I believe I'm doing this
in a few of my tasks.
The reason for (2) is that it's faster and uses less
memory, but also avoids having to store the config of
a composed task, as the task itself stores it.
Now if tasks are never to be reused, this should be
clearly documented, and avoid the burden on the task
writer to reset any state set during execute, as Antoine
pointed out several tasks do. --DD
-----Original Message-----
From: Jose Alberto Fernandez
I still do not understand the situation Antoine found with
<propertyfile/> because I thought that everytime <ant[call]/>
gets executed a complete new project instance gets
constructed, executed and thrown away. So a task should never
be reused due to repeated calls to <antcall/>.
Am I mistaken? Was something dramatically changed?
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]