diff --git a/akka-cluster/src/main/scala/akka/cluster/Cluster.scala b/akka-cluster/src/main/scala/akka/cluster/Cluster.scala index e10175f346..08b362dce0 100644 --- a/akka-cluster/src/main/scala/akka/cluster/Cluster.scala +++ b/akka-cluster/src/main/scala/akka/cluster/Cluster.scala @@ -236,10 +236,28 @@ class Cluster(val system: ExtendedActorSystem) extends Extension { /** * Try to join this cluster node with the node specified by 'address'. * A 'Join(selfAddress)' command is sent to the node to join. + * + * An actor system can only join a cluster once. Additional attempts will be ignored. + * When it has successfully joined it must be restarted to be able to join another + * cluster or to join the same cluster again. */ def join(address: Address): Unit = clusterCore ! ClusterUserAction.JoinTo(address) + /** + * Join the specified seed nodes without defining them in config. + * Especially useful from tests when Addresses are unknown before startup time. + * + * An actor system can only join a cluster once. Additional attempts will be ignored. + * When it has successfully joined it must be restarted to be able to join another + * cluster or to join the same cluster again. + * + * JAVA API: Use akka.japi.Util.immutableSeq to convert a java.lang.Iterable + * to the type needed for the seedNodes parameter. + */ + def joinSeedNodes(seedNodes: immutable.Seq[Address]): Unit = + clusterCore ! InternalClusterAction.JoinSeedNodes(seedNodes.toVector) + /** * Send command to issue state transition to LEAVING for the node specified by 'address'. */ @@ -273,14 +291,6 @@ class Cluster(val system: ExtendedActorSystem) extends Extension { // ===================== INTERNAL API ===================== // ======================================================== - /** - * Make it possible to join the specified seed nodes without defining them - * in config. Especially useful from tests when Addresses are unknown - * before startup time. - */ - private[cluster] def joinSeedNodes(seedNodes: immutable.IndexedSeq[Address]): Unit = - clusterCore ! InternalClusterAction.JoinSeedNodes(seedNodes) - /** * INTERNAL API. * diff --git a/akka-cluster/src/main/scala/akka/cluster/ClusterDaemon.scala b/akka-cluster/src/main/scala/akka/cluster/ClusterDaemon.scala index ded59ec978..79c8be0ba4 100644 --- a/akka-cluster/src/main/scala/akka/cluster/ClusterDaemon.scala +++ b/akka-cluster/src/main/scala/akka/cluster/ClusterDaemon.scala @@ -327,7 +327,9 @@ private[cluster] class ClusterCoreDaemon(publisher: ActorRef) extends Actor with case msg: SubscriptionMessage ⇒ publisher forward msg case ClusterUserAction.JoinTo(address) ⇒ logInfo("Trying to join [{}] when already part of a cluster, ignoring", address) - + case JoinSeedNodes(seedNodes) ⇒ + logInfo("Trying to join seed nodes [{}] when already part of a cluster, ignoring", + seedNodes.mkString(", ")) } def removed: Actor.Receive = {