akka/akka — pull request #1496 by patriknw (2013-05-29 07:22:42+00:00)
Title: Fix exiting ordering problem in ClusterSingletonManager, see #3408

* The problem was:
- first is leaving, second is new oldest
- two actors subscribe to cluster events, OldestChangedBuffer and ClusterSingletonManager
- ClusterSingletonManager receives MemberExited(first), and then also MemberRemoved(second)
before OldestChangedBuffer receives MemberExited(first) and delivers
OldestChanged(first->second)
- MemberRemoved(second) is the result of the cluster extension shutdown
- because ClusterSingletonManager gets the MemberRemoved(second) before the OldestChanged
it will not send the hand over data to second
- second becomes new singleton after retry period, as designed, but without hand over data

* The solution is to check the selfExited flag in Oldest state, similar to what is done
in WasOldest
* I considered the alternative to tunnel all member events through same subscriber,
but that would involve more changes to the code