diff --git a/akka-actor/src/main/scala/akka/actor/Actor.scala b/akka-actor/src/main/scala/akka/actor/Actor.scala index e2048f22cb..00bf1bbf02 100644 --- a/akka-actor/src/main/scala/akka/actor/Actor.scala +++ b/akka-actor/src/main/scala/akka/actor/Actor.scala @@ -418,7 +418,6 @@ object Actor extends ListenerManagement { } if (isHomeNode) { // home node for clustered actor - // home node, check out as LocalActorRef cluster .use(address, serializer) .getOrElse(throw new ConfigurationException( @@ -428,24 +427,11 @@ object Actor extends ListenerManagement { if (!cluster.isClustered(address)) { cluster.store(factory().start(), replicas, false, serializer) // add actor to cluster registry (if not already added) } - // Thread.sleep(5000) + // remote node (not home node), check out as ClusterActorRef cluster.ref(address, DeploymentConfig.routerTypeFor(router)) } - /* - Misc stuff: - - How to define a single ClusterNode to use? Where should it be booted up? How should it be configured? - - ClusterNode API and Actor.remote API should be made private[akka] - - Rewrite ClusterSpec or remove it - - Actor.stop on home node (actor checked out with cluster.use(..)) should do cluster.remove(..) of actor - - Should we allow configuring of session-scoped remote actors? How? - - - */ - - // RemoteActorRef(address, Actor.TIMEOUT, None) - case invalid ⇒ throw new IllegalActorStateException( "Could not create actor with address [" + address + "], not bound to a valid deployment scheme [" + invalid + "]") diff --git a/akka-actor/src/main/scala/akka/actor/ActorRef.scala b/akka-actor/src/main/scala/akka/actor/ActorRef.scala index c9efbb439f..bc5efa02b0 100644 --- a/akka-actor/src/main/scala/akka/actor/ActorRef.scala +++ b/akka-actor/src/main/scala/akka/actor/ActorRef.scala @@ -997,22 +997,7 @@ private[akka] case class RemoteActorRef private[akka] ( timeout = _timeout // FIXME BAD, we should not have different ActorRefs - /* - import DeploymentConfig._ - val remoteAddress = Deployer.deploymentFor(address) match { - case Deploy(_, _, _, Clustered(home, _, _)) ⇒ - val hostname = home match { - case Host(hostname) ⇒ hostname - case IP(address) ⇒ address - case Node(nodeName) ⇒ Config.hostname - } - new InetSocketAddress(hostname, Config.remoteServerPort) - case _ ⇒ - new InetSocketAddress(Config.hostname, Config.remoteServerPort) - //throw new IllegalStateException( - // "Actor with Address [" + address + "] is not bound to a Clustered Deployment") - } -*/ + start() def postMessageToMailbox(message: Any, senderOption: Option[ActorRef]) { diff --git a/akka-cluster/src/main/scala/akka/cluster/Cluster.scala b/akka-cluster/src/main/scala/akka/cluster/Cluster.scala index 5edf04b9fa..1403295a49 100644 --- a/akka-cluster/src/main/scala/akka/cluster/Cluster.scala +++ b/akka-cluster/src/main/scala/akka/cluster/Cluster.scala @@ -1142,15 +1142,15 @@ class DefaultClusterNode private[akka] ( * Connect to all available replicas unless already connected). */ private def connectToAllMembershipNodesInCluster() { - val runOnThisNode = false // (node: String) ⇒ !excludeRefNodeInReplicaSet && node != Config.nodename membershipNodes foreach { node ⇒ - // if (runOnThisNode(node) && !replicaConnections.contains(node)) { // only connect to each replica once - if (!replicaConnections.contains(node)) { // only connect to each replica once - val address = addressForNode(node) - EventHandler.debug(this, - "Connecting to replica with nodename [%s] and address [%s]".format(node, address)) - val clusterDaemon = Actor.remote.actorFor(RemoteClusterDaemon.ADDRESS, address.getHostName, address.getPort) - replicaConnections.put(node, (address, clusterDaemon)) + if ((node != Config.nodename)) { // no replica on the "home" node of the ref + if (!replicaConnections.contains(node)) { // only connect to each replica once + val address = addressForNode(node) + EventHandler.debug(this, + "Connecting to replica with nodename [%s] and address [%s]".format(node, address)) + val clusterDaemon = Actor.remote.actorFor(RemoteClusterDaemon.ADDRESS, address.getHostName, address.getPort) + replicaConnections.put(node, (address, clusterDaemon)) + } } } } diff --git a/akka-cluster/src/main/scala/akka/cluster/ClusterDeployer.scala b/akka-cluster/src/main/scala/akka/cluster/ClusterDeployer.scala index 0378245a14..19b89628a1 100644 --- a/akka-cluster/src/main/scala/akka/cluster/ClusterDeployer.scala +++ b/akka-cluster/src/main/scala/akka/cluster/ClusterDeployer.scala @@ -144,7 +144,9 @@ object ClusterDeployer { println("------------ INIT 2") val allDeployments = deployments ::: systemDeployments - // FIXME need to wrap in if (!deploymentDone) { .. } + ///=========================================================== + // FIXME need a flag 'deploymentDone' in ZK and to wrap the deployment in 'if (!deploymentDone) { .. }', since now the deployment is only protected by lock during the actual deployment, if node comes in later then deployment is repeated on that node again + ///=========================================================== if (deploymentLock.lock()) { println("------------ INIT 3")