Stop Child Process When Parent Process Stops
In my android application, I create a child process with Runtime.getRuntime().exec(). But may be a situation, where a user kills my application, but the child process is still runn
Solution 1:
I would
- Keep track of the processes created by my application.
- register a shutdown hook with the JVM through
Runtime.getRuntime().addShutdownHook()
that would be called when the application is shutdown and kill all the processes spawned, that were tracked in previous step.
Post a Comment for "Stop Child Process When Parent Process Stops"