I will start the post with the usual introduction:
I am making some questions in the context of my master thesis, for which I desire to understand Akka’s design. In particular, I always wonder “Why does Akka do things this way? Is there a philosophical or technical reason?”.
Suppose that we have the actor hierarchy depicted below.
Actor w is watching all the numbered actors, i.e., 1, 2, 3, 4, 5, 6, 7.
Suppose that actor 1 stops; either voluntarily, i.e., by returning Behaviors.stopped
, or because it is stopped by the user guardian.
The first question is: In what order are the numbered actors stopped?
In my mind, the following makes sense, but I don’t know if it is the actual way Akka does it:
- Actors 2, 3 and 4 concurrently receive the signal to stop.
- After 2 has received the signal to stop, actors 5, 6 and 7 concurrently receive the signal to stop.
To me, it can also make sense that all actors in the subtree rooted in 1 are stopped concurrently.
How does Akka does it? What are the respective advantages and disadvantages of these two approaches?
The second question is: In what order does actor w receive the Terminated signals?
Maybe the two design decisions are inter-dependent.
Thanks in advance to anyone who will participate in the discussion.