Join seed nodes before becoming singleton cluster, see #2267

* self is initially not member (in gossip state)
* if the join to seed nodes timeout it joins itself, and becomes
  singleton cluster
* remove the special case handling of singelton cluster in gossip
  merge, since singleton cluster is not the normal state when joining
  any more
This commit is contained in:
Patrik Nordwall 2012-06-25 21:07:44 +02:00
parent df7f558c2a
commit 25996bf284
7 changed files with 53 additions and 30 deletions

View file

@ -20,6 +20,7 @@ import akka.actor.RootActorPath
object MultiNodeClusterSpec {
def clusterConfig: Config = ConfigFactory.parseString("""
akka.cluster {
auto-join = off
auto-down = off
gossip-interval = 200 ms
heartbeat-interval = 400 ms
@ -99,10 +100,15 @@ trait MultiNodeClusterSpec extends FailureDetectorStrategy with Suite { self: Mu
def cluster: Cluster = clusterNode
/**
* Use this method instead of 'cluster.self'
* for the initial startup of the cluster node.
* Use this method for the initial startup of the cluster node.
*/
def startClusterNode(): Unit = cluster.self
def startClusterNode(): Unit = {
if (cluster.latestGossip.members.isEmpty) {
cluster join myself
awaitCond(cluster.latestGossip.members.exists(_.address == address(myself)))
} else
cluster.self
}
/**
* Initialize the cluster with the specified member