Create ClusterActorRefProvider
Reuse some of the old code. Tricky part is ensuring atomicity in creation. See ActorRefProvider.scala.
// class ClusterActorRefProvider extends ActorRefProvider { // def actorOf(props: Props, address: String): Option[ActorRef] = { // deploy match { // case Deploy(configAddress, recipe, router, failureDetector, Cluster(preferredHomeNodes, replicas, replication)) ⇒ // ClusterModule.ensureEnabled() // if (configAddress != address) throw new IllegalStateException("Deployment config for [" + address + "] is wrong [" + deploy + "]") // if (!remote.isRunning) throw new IllegalStateException("Remote server is not running") // val isHomeNode = DeploymentConfig.isHomeNode(preferredHomeNodes) // val serializer = recipe match { // case Some(r) ⇒ Serialization.serializerFor(r.implementationClass) // case None ⇒ Serialization.serializerFor(classOf[Actor]) //FIXME revisit this decision of default // } // def storeActorAndGetClusterRef(replicationScheme: ReplicationScheme, serializer: Serializer): ActorRef = { // // add actor to cluster registry (if not already added) // if (!cluster.isClustered(address)) //WARNING!!!! Racy // cluster.store(address, factory, replicas.factor, replicationScheme, false, serializer) // // remote node (not home node), check out as ClusterActorRef // cluster.ref(address, DeploymentConfig.routerTypeFor(router), DeploymentConfig.failureDetectorTypeFor(failureDetector)) // } // replication match { // case _: Transient | Transient ⇒ // storeActorAndGetClusterRef(Transient, serializer) // case replication: Replication ⇒ // if (DeploymentConfig.routerTypeFor(router) != akka.routing.RouterType.Direct) throw new ConfigurationException( // "Can't replicate an actor [" + address + "] configured with another router than \"direct\" - found [" + router + "]") // if (isHomeNode) { // stateful actor's home node // cluster.use(address, serializer) // .getOrElse(throw new ConfigurationException( // "Could not check out actor [" + address + "] from cluster registry as a \"local\" actor")) // } else { // storeActorAndGetClusterRef(replication, serializer) // } // } // case invalid ⇒ throw new IllegalActorStateException( // "Could not create actor with address [" + address + "], not bound to a valid deployment scheme [" + invalid + "]") // } // } // def findActorRef(address: String): Option[ActorRef] // }
Leave a comment
on 2011-09-27 14:32 *
By Jonas Bonér
Component changed from None to cluster
Description changed from Use code commented out in A... to Reuse some of the old code....
Milestone changed from 2.0 to 2.1
Updating tickets (#620, #679, #725, #750, #752, #753, #754, #763, #789, #870, #893, #922, #953, #954, #971, #977, #983, #985, #987, #991, #1026, #1045, #1051, #1060, #1061, #1084, #1098, #1099, #1133, #1134, #1135, #1136, #1137, #1194, #1225, #1226, #1243, #1245, #1247, #1248, #1254, #1261, #1300, #1317, #1391, #1412, #1791, #1793, #1901, #1908, #1911, #1912, #1913, #1914, #1915, #1916, #1917, #1922, #1983, #1987, #1996, #1997, #1998, #2066, #2077, #2105, #2117, #2133, #2143, #2149, #2151, #2152, #2153, #2155, #2157, #2158, #2159, #2160, #2161, #2162, #2163, #2164, #2165, #2167, #2171, #2175, #2176, #2177, #2180, #2182, #2184, #2185, #2193, #2199, #2202, #2204, #2206, #2207, #2209, #2210)