Maintain AddressTerminated subscription in DeathWatch, see #1588

This commit is contained in:
Patrik Nordwall 2012-09-03 20:37:33 +02:00
parent dad04cf9e5
commit 6b40ddc755
4 changed files with 77 additions and 37 deletions

View file

@ -9,7 +9,7 @@ import akka.actor.{ Actor, ActorLogging, ActorRef, Address }
import akka.cluster.ClusterEvent._
import akka.cluster.MemberStatus._
import akka.event.EventStream
import akka.actor.NodeUnreachable
import akka.actor.AddressTerminated
/**
* Domain events published to the event bus.
@ -200,10 +200,14 @@ private[cluster] final class ClusterDomainEventPublisher(environment: ClusterEnv
def publishChanges(oldGossip: Gossip, newGossip: Gossip): Unit = {
// keep the latestGossip to be sent to new subscribers
latestGossip = newGossip
val events = diff(oldGossip, newGossip)
events foreach { eventStream publish }
// notify DeathWatch about the unreachable node
events collect { case MemberUnreachable(m) NodeUnreachable(m.address) } foreach { eventStream publish }
diff(oldGossip, newGossip) foreach { event
eventStream publish event
// notify DeathWatch about unreachable node
event match {
case MemberUnreachable(m) eventStream publish AddressTerminated(m.address)
case _
}
}
}
def publishInternalStats(currentStats: CurrentInternalStats): Unit = {