An Akka 2 terminator (Akka actors, kill, gracefulStop)

When an Actor stops, its children stop in an undefined order. Child termination is asynchronous and thus non-deterministic. If an Actor has children that have order dependencies, then you might need to ensure a particular shutdown order of those children so that their postStop() methods get called in the right order. This pattern approaches that problem by introducing an Actor type that we’ll call a Terminator.

The goal is to provide control over how the “children” die. In order to achieve this goal, we are going to change the surface of the problem so that we no longer have these children, in the normal sense.