Updates based on feedback - use of abstract member variables specific to the router type. See #1529

This commit is contained in:
Henrik Engstrom 2011-12-21 10:03:26 +01:00
parent 0dc161c800
commit dac0beb01b
4 changed files with 38 additions and 28 deletions

View file

@ -26,9 +26,9 @@ class RemoteDeployer(_settings: ActorSystem.Settings) extends Deployer(_settings
if (nodes.isEmpty || deploy.routing == NoRouter) d
else {
val r = deploy.routing match {
case RoundRobinRouter(x, _, w) RemoteRoundRobinRouter(x, nodes, w)
case RandomRouter(x, _, w) RemoteRandomRouter(x, nodes, w)
case BroadcastRouter(x, _, w) RemoteBroadcastRouter(x, nodes, w)
case RoundRobinRouter(x, _) RemoteRoundRobinRouter(x, nodes)
case RandomRouter(x, _) RemoteRandomRouter(x, nodes)
case BroadcastRouter(x, _) RemoteBroadcastRouter(x, nodes)
case ScatterGatherFirstCompletedRouter(x, _, w) RemoteScatterGatherFirstCompletedRouter(x, nodes, w)
}
Some(deploy.copy(routing = r))

View file

@ -39,13 +39,13 @@ trait RemoteRouterConfig extends RouterConfig {
* if you provide either 'nrOfInstances' or 'routees' to during instantiation they will
* be ignored if the 'nrOfInstances' is defined in the configuration file for the actor being used.
*/
case class RemoteRoundRobinRouter(nrOfInstances: Int, routees: Iterable[String], within: Duration) extends RemoteRouterConfig with RoundRobinLike {
case class RemoteRoundRobinRouter(nrOfInstances: Int, routees: Iterable[String]) extends RemoteRouterConfig with RoundRobinLike {
/**
* Constructor that sets the routees to be used.
* Java API
*/
def this(n: Int, t: java.util.Collection[String], w: Duration) = this(n, t.asScala, w)
def this(n: Int, t: java.util.Collection[String]) = this(n, t.asScala)
}
/**
@ -59,13 +59,13 @@ case class RemoteRoundRobinRouter(nrOfInstances: Int, routees: Iterable[String],
* if you provide either 'nrOfInstances' or 'routees' to during instantiation they will
* be ignored if the 'nrOfInstances' is defined in the configuration file for the actor being used.
*/
case class RemoteRandomRouter(nrOfInstances: Int, routees: Iterable[String], within: Duration) extends RemoteRouterConfig with RandomLike {
case class RemoteRandomRouter(nrOfInstances: Int, routees: Iterable[String]) extends RemoteRouterConfig with RandomLike {
/**
* Constructor that sets the routees to be used.
* Java API
*/
def this(n: Int, t: java.util.Collection[String], w: Duration) = this(n, t.asScala, w)
def this(n: Int, t: java.util.Collection[String]) = this(n, t.asScala)
}
/**
@ -79,13 +79,13 @@ case class RemoteRandomRouter(nrOfInstances: Int, routees: Iterable[String], wit
* if you provide either 'nrOfInstances' or 'routees' to during instantiation they will
* be ignored if the 'nrOfInstances' is defined in the configuration file for the actor being used.
*/
case class RemoteBroadcastRouter(nrOfInstances: Int, routees: Iterable[String], within: Duration) extends RemoteRouterConfig with BroadcastLike {
case class RemoteBroadcastRouter(nrOfInstances: Int, routees: Iterable[String]) extends RemoteRouterConfig with BroadcastLike {
/**
* Constructor that sets the routees to be used.
* Java API
*/
def this(n: Int, t: java.util.Collection[String], w: Duration) = this(n, t.asScala, w)
def this(n: Int, t: java.util.Collection[String]) = this(n, t.asScala)
}
/**