Rename to allowLocalRoutees in code also, see #2103

This commit is contained in:
Patrik Nordwall 2012-09-11 20:49:08 +02:00
parent 87b3813c07
commit e55cde2591
3 changed files with 16 additions and 16 deletions

View file

@ -43,7 +43,7 @@ private[akka] class ClusterDeployer(_settings: ActorSystem.Settings, _pm: Dynami
val clusterRouterSettings = ClusterRouterSettings( val clusterRouterSettings = ClusterRouterSettings(
totalInstances = deploy.config.getInt("nr-of-instances"), totalInstances = deploy.config.getInt("nr-of-instances"),
maxInstancesPerNode = deploy.config.getInt("cluster.max-nr-of-instances-per-node"), maxInstancesPerNode = deploy.config.getInt("cluster.max-nr-of-instances-per-node"),
routeesOnOwnNode = deploy.config.getBoolean("cluster.allow-local-routees"), allowLocalRoutees = deploy.config.getBoolean("cluster.allow-local-routees"),
routeesPath = deploy.config.getString("cluster.routees-path")) routeesPath = deploy.config.getString("cluster.routees-path"))
Some(deploy.copy( Some(deploy.copy(

View file

@ -76,26 +76,26 @@ object ClusterRouterSettings {
/** /**
* Settings for create and deploy of the routees * Settings for create and deploy of the routees
*/ */
def apply(totalInstances: Int, maxInstancesPerNode: Int, routeesOnOwnNode: Boolean): ClusterRouterSettings = def apply(totalInstances: Int, maxInstancesPerNode: Int, allowLocalRoutees: Boolean): ClusterRouterSettings =
new ClusterRouterSettings(totalInstances, maxInstancesPerNode, routeesOnOwnNode) new ClusterRouterSettings(totalInstances, maxInstancesPerNode, allowLocalRoutees)
/** /**
* Settings for remote deployment of the routees, allowed to use routees on own node * Settings for remote deployment of the routees, allowed to use routees on own node
*/ */
def apply(totalInstances: Int, maxInstancesPerNode: Int): ClusterRouterSettings = def apply(totalInstances: Int, maxInstancesPerNode: Int): ClusterRouterSettings =
apply(totalInstances, maxInstancesPerNode, routeesOnOwnNode = true) apply(totalInstances, maxInstancesPerNode, allowLocalRoutees = true)
/** /**
* Settings for lookup of the routees * Settings for lookup of the routees
*/ */
def apply(totalInstances: Int, routeesPath: String, routeesOnOwnNode: Boolean): ClusterRouterSettings = def apply(totalInstances: Int, routeesPath: String, allowLocalRoutees: Boolean): ClusterRouterSettings =
new ClusterRouterSettings(totalInstances, routeesPath, routeesOnOwnNode) new ClusterRouterSettings(totalInstances, routeesPath, allowLocalRoutees)
/** /**
* Settings for lookup of the routees, allowed to use routees on own node * Settings for lookup of the routees, allowed to use routees on own node
*/ */
def apply(totalInstances: Int, routeesPath: String): ClusterRouterSettings = def apply(totalInstances: Int, routeesPath: String): ClusterRouterSettings =
apply(totalInstances, routeesPath, routeesOnOwnNode = true) apply(totalInstances, routeesPath, allowLocalRoutees = true)
} }
/** /**
@ -108,21 +108,21 @@ case class ClusterRouterSettings private[akka] (
totalInstances: Int, totalInstances: Int,
maxInstancesPerNode: Int, maxInstancesPerNode: Int,
routeesPath: String, routeesPath: String,
routeesOnOwnNode: Boolean) { allowLocalRoutees: Boolean) {
/** /**
* Settings for create and deploy of the routees * Settings for create and deploy of the routees
* JAVA API * JAVA API
*/ */
def this(totalInstances: Int, maxInstancesPerNode: Int, routeesOnOwnNode: Boolean) = def this(totalInstances: Int, maxInstancesPerNode: Int, allowLocalRoutees: Boolean) =
this(totalInstances, maxInstancesPerNode, routeesPath = "", routeesOnOwnNode) this(totalInstances, maxInstancesPerNode, routeesPath = "", allowLocalRoutees)
/** /**
* Settings for lookup of the routees * Settings for lookup of the routees
* JAVA API * JAVA API
*/ */
def this(totalInstances: Int, routeesPath: String, routeesOnOwnNode: Boolean) = def this(totalInstances: Int, routeesPath: String, allowLocalRoutees: Boolean) =
this(totalInstances, maxInstancesPerNode = 1, routeesPath, routeesOnOwnNode) this(totalInstances, maxInstancesPerNode = 1, routeesPath, allowLocalRoutees)
if (totalInstances <= 0) throw new IllegalArgumentException("totalInstances of cluster router must be > 0") if (totalInstances <= 0) throw new IllegalArgumentException("totalInstances of cluster router must be > 0")
if (maxInstancesPerNode <= 0) throw new IllegalArgumentException("maxInstancesPerNode of cluster router must be > 0") if (maxInstancesPerNode <= 0) throw new IllegalArgumentException("maxInstancesPerNode of cluster router must be > 0")
@ -213,7 +213,7 @@ private[akka] class ClusterRouteeProvider(
private[routing] def availbleNodes: SortedSet[Address] = { private[routing] def availbleNodes: SortedSet[Address] = {
import Member.addressOrdering import Member.addressOrdering
val currentNodes = nodes val currentNodes = nodes
if (currentNodes.isEmpty && settings.routeesOnOwnNode) if (currentNodes.isEmpty && settings.allowLocalRoutees)
//use my own node, cluster information not updated yet //use my own node, cluster information not updated yet
SortedSet(cluster.selfAddress) SortedSet(cluster.selfAddress)
else else
@ -229,7 +229,7 @@ private[akka] class ClusterRouteeProvider(
} }
private[routing] def isAvailble(m: Member): Boolean = { private[routing] def isAvailble(m: Member): Boolean = {
m.status == MemberStatus.Up && (settings.routeesOnOwnNode || m.address != cluster.selfAddress) m.status == MemberStatus.Up && (settings.allowLocalRoutees || m.address != cluster.selfAddress)
} }
} }

View file

@ -53,7 +53,7 @@ class ClusterDeployerSpec extends AkkaSpec(ClusterDeployerSpec.deployerConf) {
service, service,
deployment.get.config, deployment.get.config,
ClusterRouterConfig(RoundRobinRouter(20), ClusterRouterSettings( ClusterRouterConfig(RoundRobinRouter(20), ClusterRouterSettings(
totalInstances = 20, maxInstancesPerNode = 3, routeesOnOwnNode = false)), totalInstances = 20, maxInstancesPerNode = 3, allowLocalRoutees = false)),
ClusterScope))) ClusterScope)))
} }
@ -67,7 +67,7 @@ class ClusterDeployerSpec extends AkkaSpec(ClusterDeployerSpec.deployerConf) {
service, service,
deployment.get.config, deployment.get.config,
ClusterRouterConfig(RoundRobinRouter(20), ClusterRouterSettings( ClusterRouterConfig(RoundRobinRouter(20), ClusterRouterSettings(
totalInstances = 20, routeesPath = "/user/myservice", routeesOnOwnNode = false)), totalInstances = 20, routeesPath = "/user/myservice", allowLocalRoutees = false)),
ClusterScope))) ClusterScope)))
} }