Re: Terminating a process tree
From: marcus (marcus_at_welby.md)
Date: 11/09/04
- Next message: Michael Rauscher: "Re: Object reference side effects - desirable?"
- Previous message: Nevermind: "Which design pattern?"
- In reply to: Wayne Marrison: "Terminating a process tree"
- Next in thread: Wayne Marrison: "Re: Terminating a process tree"
- Reply: Wayne Marrison: "Re: Terminating a process tree"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 08 Nov 2004 18:44:22 -0800
Hey Wayne,
Since you agree this isn't the correct way to do it and you need a hack,
I can suggest one that has worked for me in FreeBSD (should work in any
linux type environment). Instead of launching the second java program
directly I used a control script (stolen from my apache setup, I think)
that records the PID in a dedicated text file. When I needed to kill it
I invoked the control script, which issued the OS kill command on the
recorded PID. Kills it dead as far as I know.
Wayne Marrison wrote:
> (posted yesterday in comp.lang.java.help, but not sure if that was the right
> place and had no response, so posting in here today, sorry for the
> additional bandwidth to those that subscribe to both groups)
>
> 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
>
>
- Next message: Michael Rauscher: "Re: Object reference side effects - desirable?"
- Previous message: Nevermind: "Which design pattern?"
- In reply to: Wayne Marrison: "Terminating a process tree"
- Next in thread: Wayne Marrison: "Re: Terminating a process tree"
- Reply: Wayne Marrison: "Re: Terminating a process tree"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|