The clean up you propose sounds very good.

As regards whether the ant family tasks should fire build started
and finished events. One may see these for <subant>, and <ant>
but not for <antcall> (or at least the way it is used by some scripts
as a sub-routine call). In any case, as you say, it cannot be
changed for backwards compatibility reasons.

Peter

Stefan Bodewig wrote:

Hi all,

while investigating bug 8689 I realized that the Ant project instances
we create in Ant never fire the build started or finished events.  I'm
not entirely sure that this is a good thing (but it probably is), but
we probably can't change it for backwards compatibility reasons
anyway.

This has a couple of consequences, one of them causes the excess
memory needed in AntClassLoader.  If a task in the subbuild creates an
AntClassLoader instance it never gets cleaned up since the subproject
never calls build finished.

Another one is that any <record> task used in the subbuild could leave
open files hanging around until Ant exits.  For what I propose below,
I'll also have to add a close method to RecorderEntry.

Since I don't think we can "fix" the build* events for subbuilds, I
plan to do some things in <ant> after the subbuild has finished:

* remove all build listeners of the main project from the subbuild.

* iterate over the remaining build listeners of the subbuild and
a) invoke cleanup() if it is an AntClassLoader


 b) invoke close() if it is a RecorderEntry

this is ugly, but any clean solution I could come up with is not
backwards compatible (add a dispose method to BuildListener, make
subbuilds fire buildFinished ...).

Any better ideas?

Stefan

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



Reply via email to