diff --git a/akka-cluster/src/main/scala/akka/cluster/ClusterDaemon.scala b/akka-cluster/src/main/scala/akka/cluster/ClusterDaemon.scala index 9608d18b72..6023e847a4 100644 --- a/akka-cluster/src/main/scala/akka/cluster/ClusterDaemon.scala +++ b/akka-cluster/src/main/scala/akka/cluster/ClusterDaemon.scala @@ -444,7 +444,7 @@ private[cluster] class ClusterCoreDaemon(publisher: ActorRef, joinConfigCompatCh def uninitialized: Actor.Receive = ({ - case InitJoin => + case InitJoin(_) => logInfo("Received InitJoin message from [{}], but this node is not initialized yet", sender()) sender() ! InitJoinNack(selfAddress) case ClusterUserAction.JoinTo(address) => @@ -465,7 +465,7 @@ private[cluster] class ClusterCoreDaemon(publisher: ActorRef, joinConfigCompatCh ({ case Welcome(from, gossip) => welcome(joinWith, from, gossip) - case InitJoin => + case InitJoin(_) => logInfo("Received InitJoin message from [{}], but this node is not a member yet", sender()) sender() ! InitJoinNack(selfAddress) case ClusterUserAction.JoinTo(address) => diff --git a/akka-cluster/src/test/scala/akka/cluster/ClusterSpec.scala b/akka-cluster/src/test/scala/akka/cluster/ClusterSpec.scala index 0bf336e94d..644faff7c4 100644 --- a/akka-cluster/src/test/scala/akka/cluster/ClusterSpec.scala +++ b/akka-cluster/src/test/scala/akka/cluster/ClusterSpec.scala @@ -65,6 +65,11 @@ class ClusterSpec extends AkkaSpec(ClusterSpec.config) with ImplicitSender { info.getOperations.length should be > (0) } + "reply with InitJoinNack for InitJoin before joining" in { + system.actorSelection("/system/cluster/core/daemon") ! InitJoin(system.settings.config) + expectMsgType[InitJoinNack] + } + "initially become singleton cluster when joining itself and reach convergence" in { clusterView.members.size should ===(0) cluster.join(selfAddress) @@ -75,6 +80,11 @@ class ClusterSpec extends AkkaSpec(ClusterSpec.config) with ImplicitSender { awaitAssert(clusterView.status should ===(MemberStatus.Up)) } + "reply with InitJoinAck for InitJoin after joining" in { + system.actorSelection("/system/cluster/core/daemon") ! InitJoin(system.settings.config) + expectMsgType[InitJoinAck] + } + "publish initial state as snapshot to subscribers" in { try { cluster.subscribe(testActor, ClusterEvent.InitialStateAsSnapshot, classOf[ClusterEvent.MemberEvent])