You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by David Morris <Da...@plumcreek.com> on 2003/06/08 01:23:24 UTC

Task connection cleanup

I created an Ant task that opens a shared connection that needs to be
cleaned up at the end of a build. So far, I have come up with three
ideas:

1. Wrap the task(s) in a connection task.
2. Cleanup on finalize.
3. Use a build listener and somehow register the connection for cleanup
(can a task implement a BuildListener?)

I would appreciate any comments on these ideas or alternative
suggestions.

Thanks,

David Morris

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


Re: Task connection cleanup

Posted by Antoine Levy-Lambert <le...@tiscali-dsl.de>.
The idea with the BuildListener is OK.
A task in ant is simply a public class with a public void execute() method
in in it.
Tasks are identified as such when they are in the defaults.properties file
of org/apache/tools/ant/taskdefs or when you use the <taskdef/> task to
introduce them.
So, yes, you certainly can create a listener class which is also a task.
What you also can do is create a disconnection task and separately a
listener which calls the disconnection task when the build is finished (with
success or failure).
The MailLogger is a logger which is taking action in the same circumstances
like the one you want to have (success or failure of the build).
The only point to pay attention on : it is unspecified what happens when a
listener delegates to a task which itself wants to use ant's logging system.
Antoine
----- Original Message -----
From: "David Morris" <Da...@plumcreek.com>
To: <us...@ant.apache.org>
Sent: Sunday, June 08, 2003 1:23 AM
Subject: Task connection cleanup


> I created an Ant task that opens a shared connection that needs to be
> cleaned up at the end of a build. So far, I have come up with three
> ideas:
>
> 1. Wrap the task(s) in a connection task.
> 2. Cleanup on finalize.
> 3. Use a build listener and somehow register the connection for cleanup
> (can a task implement a BuildListener?)
>
> I would appreciate any comments on these ideas or alternative
> suggestions.
>
> Thanks,
>
> David Morris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>



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


Re: Task connection cleanup

Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
Have a look at the <sound> task for a built-in task that does very 
thing, registers a BuildListener (not the same class, but it could be 
certainly).

	Erik


On Saturday, June 7, 2003, at 07:23  PM, David Morris wrote:

> I created an Ant task that opens a shared connection that needs to be
> cleaned up at the end of a build. So far, I have come up with three
> ideas:
>
> 1. Wrap the task(s) in a connection task.
> 2. Cleanup on finalize.
> 3. Use a build listener and somehow register the connection for cleanup
> (can a task implement a BuildListener?)
>
> I would appreciate any comments on these ideas or alternative
> suggestions.
>
> Thanks,
>
> David Morris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>


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