One plan is probably to have a lightweight wrapper that listens for a _kill_
signal of some
description.
I have some code that does something like this.
It wraps a process and can buffer the input/output and kill the process it
wraps.
You run the other jvm from the java task with a fork but can get all the output
back by running
the task again and issuing an different command.
eg
<target name="start">
<wrapper command="java" signal="start" port="1234" address="localhost">
<args etc etc etc>
<wrapper>
</target>
<target name="stop">
<wrapper signal="stop" port="1234" address="localhost"/>
</target>
> Thanks for your answer. Here are some more details :
> - Assume I can't change the code to check for cancels (which I agree is the
> best way to do it !),
> - The thread that I want to kill spawns a process in another JVM (that's the
> Ant java task) and when I call stop() on the thread that started this other
> JVM, it does not stop this other JVM
>
> I have come to the conclusion that there is no simple way to do it ... But
> if anyone has a clue ... :)
> Thanks.
> Vincent.
>
--- BEGIN GEEK CODE BLOCK ---
Version 3.12
GCS d+(-) s:- a-- C++(+++)$ UL++++(H)(S)$ P+++$ L+++$>++++
E--- W++ N++ o++ K? !w() O? !M V? PS+ PE+++ Y+ t+ 5++ X++
R(+) !tv b++(++++) D++ G>++ e++> h--()(*) r+ y+()
--- END GEEK CODE BLOCK ---