A bit of background.
I maintain a mutation testing system for Java. A main process launches child processes that contain automatically modified versions of a program.
This could result in the code in the child process getting stuck in infinite loops, running out of memory or crashing in any number of ways.
When the system detects that this has happened the main process kills the child using process.destroy and recovers the analysis.
Earlier versions shut the child process down from inside using System.exit, but I changed to killing the child processes from the main one using process.destroy as this was more robust.
I've now had a bug report that the child processes are failing to fully shutdown in some (as yet un-reproduced) circumstance when the code uses spring's DefaultMessageListenerContainer.
I assume the issue in some way relates to blocking io, and the process getting into the kind of state that requires a kill -9.
The actual question
So the question is - is there a more reliable platform independent way of killing a process in java than process.destroy?