ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: Taskdef warnings and ^C fix
Date Tue, 07 May 2002 09:03:24 GMT
On Mon, 6 May 2002, Hal Hildebrand <Hal.Hildebrand@hellblazer.com>
wrote:

> In looking at the code, the problem is that the classes are being
> compared, and since the apparently come from different classloaders,
> the classes don't compare .equals(), thus the error message.

If they come from different class loaders, they may really be
different versions of the same class or simply just have access to
different classes - they are not the same.

The warning may be annoying for you, but in general, it is no false
alarm and something people should be made aware of IMHO.

> The fix we've been using is to use the shutdown hook of the VM to
> destroy the spawned processes on exit.  For example, in Exec.run(),
> 
>             // exec command on system runtime
>             Process proc = Runtime.getRuntime().exec(command);
> 
>             // kill me if Ctrl-C the process
>             ProcessKiller killer = new ProcessKiller(proc);
>             Runtime.getRuntime().addShutdownHook(killer);

<exec> is implemented by ExecTask which delegates the work to
Execute.  This uses a ProcessDestroyer and adds it as a shutdown hook
via reflection (so we can compile on JDK < 1.3).

The code is very similar to yours, so if the shutdown hook gets
triggered by ^Cing Ant - the spawned processes should be killed as
well.

Stefan

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