Terminate a process tree  
Author Message
Wayne Marrison





PostPosted: 2004-11-7 16:36:00 Top

java-programmer, Terminate a process tree Hi group,

I'm new here, so apologies if I ask this in the wrong way.

I have been programming in java for about 2 months, and am currently trying
to control an external application that I start using:

Process proc;
Runtime rt;

proc = rt.exec("java.exe -cp ... etc.. something");

Then I capture the input/output & error streams and thread them off.

The problem I have, is that I need to architect for the eventuality of the
external process locking up and not responding to requests. I have the
whole capturing of streams in a timeout, so I can tell when the external
program has not responded within a reasonable time, however when I issue the
proc.destroy() method, the java.exe process takes up almost 100% cpu and
never stops. I have to use operating system tools to perform a manual kill
of the process.

I can only assume that the proc.destroy() doesnt kill the entire process
tree, and because the command line starts off java.exe, which runs the
something.class file, a process is orphaned somewhere.

Any help would be much appreciated.

Thanks

Wayne