In Akka, what happens if I watch() a dead ActorRef?
akka, watch
Solution
I think the documentation is pretty clear:
"One important property is that the message will be delivered irrespective of the order in which the monitoring request and target’s termination occur, i.e. you still get the message even if at the time of registration the target is already dead."
- http://doc.akka.io/docs/akka/2.0.1/general/supervision.html
And, you do not need to unwatch since the actor can't die twice, and it's not reference counted. It's binary.
Cheers, √
Problem
If I call context.watch() on an ActorRef that is already dead, am I guaranteed to still receive a termination message? Also, after having received a termination message regarding a specific actor, do I still need to call unwatch()? Also, are watch() calls reference counted? If I call watch() twice, followed by unwatch() once, am I guaranteed to still get termination messages?