Publish clean state when joining (PublishStart), see #2871

* The failure in JoinTwoClustersSpec was due to missing publishing
  of cluster events when clearing current state when joining
* This fix is in the right direction, but joining clusters like this
  will need some design thought, creating ticket 2873 for that
This commit is contained in:
Patrik Nordwall 2013-01-04 16:39:48 +01:00
parent 5d53ec0c52
commit 943c438d5e
5 changed files with 31 additions and 11 deletions

View file

@ -238,8 +238,8 @@ object ClusterEvent {
private[cluster] final class ClusterDomainEventPublisher extends Actor with ActorLogging {
import InternalClusterAction._
var latestGossip: Gossip = Gossip()
var latestConvergedGossip: Gossip = Gossip()
var latestGossip: Gossip = Gossip.empty
var latestConvergedGossip: Gossip = Gossip.empty
var memberEvents: immutable.Seq[MemberEvent] = immutable.Seq.empty
def receive = {
@ -313,7 +313,11 @@ private[cluster] final class ClusterDomainEventPublisher extends Actor with Acto
def publish(event: AnyRef): Unit = eventStream publish event
def publishStart(): Unit = clearState()
def publishStart(): Unit =
if ((latestGossip ne Gossip.empty) || (latestConvergedGossip ne Gossip.empty)) {
clearState()
publishCurrentClusterState(None)
}
def publishDone(receiver: ActorRef): Unit = {
clearState()
@ -321,7 +325,7 @@ private[cluster] final class ClusterDomainEventPublisher extends Actor with Acto
}
def clearState(): Unit = {
latestGossip = Gossip()
latestConvergedGossip = Gossip()
latestGossip = Gossip.empty
latestConvergedGossip = Gossip.empty
}
}