You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Robert Heumüller <ma...@heum.de> on 2012/04/22 11:59:29 UTC

[exec] How to ensure a subprocess ends with the parent application

Hello,

this is my first post on the apache-commons mailing list - actually
it's my first venture into mailing lists in general :)

I currently use commons-exec in order to start instances of
avahi-browse and avahi-publish. Everything seems to work neatly
excepting the fact that avahi-publish does not quit when the
application ends (for example when I kill via stop button in eclipse).
How can I ensure that a subprocess started by exec is terminated when
the parent process dies? My code looks like this:

http://privatepaste.com/a6b0a35a3c

Thank you for your assistance

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


Re: [exec] How to ensure a subprocess ends with the parent application

Posted by Robert Heumüller <ma...@heum.de>.
Thank you kindly,

this looks exactly like what I was looking for.

Robert


Am Sun, 22 Apr 2012 22:53:27 +0200
schrieb Siegfried Goeschl <si...@it20one.at>:

> Hi Robert,
> 
> welcome at the Apache Commons mailing list  then ... :-)
> 
> Can you check out "ProcessDestroyer" and its implementation 
> "ShutdownHookProcessDestroyer" - "ShutdownHookProcessDestroyer" 
> registers a shutdown hook at JVM level and should do the trick in
> your case. Some test code is found at "DefaultExecutorTest.java"
> 
> Cheers,
> 
> Siegfried Goeschl
> 
> 
> On 22.04.12 11:59, Robert Heumüller wrote:
> > Hello,
> >
> > this is my first post on the apache-commons mailing list - actually
> > it's my first venture into mailing lists in general :)
> >
> > I currently use commons-exec in order to start instances of
> > avahi-browse and avahi-publish. Everything seems to work neatly
> > excepting the fact that avahi-publish does not quit when the
> > application ends (for example when I kill via stop button in
> > eclipse). How can I ensure that a subprocess started by exec is
> > terminated when the parent process dies? My code looks like this:
> >
> > http://privatepaste.com/a6b0a35a3c
> >
> > Thank you for your assistance
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> > For additional commands, e-mail: user-help@commons.apache.org
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
> 


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


Re: [exec] How to ensure a subprocess ends with the parent application

Posted by Siegfried Goeschl <si...@it20one.at>.
Hi Robert,

welcome at the Apache Commons mailing list  then ... :-)

Can you check out "ProcessDestroyer" and its implementation 
"ShutdownHookProcessDestroyer" - "ShutdownHookProcessDestroyer" 
registers a shutdown hook at JVM level and should do the trick in your 
case. Some test code is found at "DefaultExecutorTest.java"

Cheers,

Siegfried Goeschl


On 22.04.12 11:59, Robert Heumüller wrote:
> Hello,
>
> this is my first post on the apache-commons mailing list - actually
> it's my first venture into mailing lists in general :)
>
> I currently use commons-exec in order to start instances of
> avahi-browse and avahi-publish. Everything seems to work neatly
> excepting the fact that avahi-publish does not quit when the
> application ends (for example when I kill via stop button in eclipse).
> How can I ensure that a subprocess started by exec is terminated when
> the parent process dies? My code looks like this:
>
> http://privatepaste.com/a6b0a35a3c
>
> Thank you for your assistance
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>

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