For unit testing, I'm running multiple Ignite nodes in the same JVM (as discussed in the answer here ).
In my unit tests I want to simulate what happens when an Ignite node unexpectedly dies, e.g. to simulate a sudden hardware failure and the effects of it on the cluster as a whole. I can't just call Ignite.close() because this does an orderly shutdown, and I want a sudden disorderly shutdown, with all the problems it could bring.
I can think of two potential ways to do this:
When I start a new ignite node in my JVM, somehow keep track of all the threads it spawns and then use (the deprecated) method thread.stop to kill all its threads abruptly when I want to simulate it dying. I can't see a way of reliably distinguishing between threads launched by one Ignite in the JVM from threads spawned by another though, unless I assume Ignite starts all its threads at startup only.
Launch a separate process using the Java process API (see first answer here ), start ignite in that process and then kill it by force using Process.destroy() or Process.destroyForcibly().
Does anyone know a better approach?
I'm using Java 8.