rename Props.withRouting to .withRouter
This commit is contained in:
parent
4b2b41e725
commit
4bd9f6ae1a
11 changed files with 28 additions and 28 deletions
Binary file not shown.
|
|
@ -20,7 +20,7 @@ class ConfiguredLocalRoutingSpec extends AkkaSpec with DefaultTimeout with Impli
|
|||
def receive = {
|
||||
case "get" ⇒ sender ! context.props
|
||||
}
|
||||
}).withRouting(RoundRobinRouter(12)), "config")
|
||||
}).withRouter(RoundRobinRouter(12)), "config")
|
||||
actor.asInstanceOf[LocalActorRef].underlying.props.routerConfig must be === RandomRouter(4)
|
||||
}
|
||||
|
||||
|
|
@ -40,7 +40,7 @@ class ConfiguredLocalRoutingSpec extends AkkaSpec with DefaultTimeout with Impli
|
|||
override def postStop() {
|
||||
stopLatch.countDown()
|
||||
}
|
||||
}).withRouting(RoundRobinRouter(5)), "round-robin-shutdown")
|
||||
}).withRouter(RoundRobinRouter(5)), "round-robin-shutdown")
|
||||
|
||||
actor ! "hello"
|
||||
actor ! "hello"
|
||||
|
|
@ -70,7 +70,7 @@ class ConfiguredLocalRoutingSpec extends AkkaSpec with DefaultTimeout with Impli
|
|||
case "hit" ⇒ sender ! id
|
||||
case "end" ⇒ doneLatch.countDown()
|
||||
}
|
||||
}).withRouting(RoundRobinRouter(connectionCount)), "round-robin")
|
||||
}).withRouter(RoundRobinRouter(connectionCount)), "round-robin")
|
||||
|
||||
for (i ← 0 until iterationCount) {
|
||||
for (k ← 0 until connectionCount) {
|
||||
|
|
@ -99,7 +99,7 @@ class ConfiguredLocalRoutingSpec extends AkkaSpec with DefaultTimeout with Impli
|
|||
override def postStop() {
|
||||
stopLatch.countDown()
|
||||
}
|
||||
}).withRouting(RoundRobinRouter(5)), "round-robin-broadcast")
|
||||
}).withRouter(RoundRobinRouter(5)), "round-robin-broadcast")
|
||||
|
||||
actor ! Broadcast("hello")
|
||||
helloLatch.await(5, TimeUnit.SECONDS) must be(true)
|
||||
|
|
@ -122,7 +122,7 @@ class ConfiguredLocalRoutingSpec extends AkkaSpec with DefaultTimeout with Impli
|
|||
override def postStop() {
|
||||
stopLatch.countDown()
|
||||
}
|
||||
}).withRouting(RandomRouter(7)), "random-shutdown")
|
||||
}).withRouter(RandomRouter(7)), "random-shutdown")
|
||||
|
||||
actor ! "hello"
|
||||
actor ! "hello"
|
||||
|
|
@ -155,7 +155,7 @@ class ConfiguredLocalRoutingSpec extends AkkaSpec with DefaultTimeout with Impli
|
|||
case "hit" ⇒ sender ! id
|
||||
case "end" ⇒ doneLatch.countDown()
|
||||
}
|
||||
}).withRouting(RandomRouter(connectionCount)), "random")
|
||||
}).withRouter(RandomRouter(connectionCount)), "random")
|
||||
|
||||
for (i ← 0 until iterationCount) {
|
||||
for (k ← 0 until connectionCount) {
|
||||
|
|
@ -185,7 +185,7 @@ class ConfiguredLocalRoutingSpec extends AkkaSpec with DefaultTimeout with Impli
|
|||
override def postStop() {
|
||||
stopLatch.countDown()
|
||||
}
|
||||
}).withRouting(RandomRouter(6)), "random-broadcast")
|
||||
}).withRouter(RandomRouter(6)), "random-broadcast")
|
||||
|
||||
actor ! Broadcast("hello")
|
||||
helloLatch.await(5, TimeUnit.SECONDS) must be(true)
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class RoutingSpec extends AkkaSpec with DefaultTimeout {
|
|||
|
||||
"no router" must {
|
||||
"be started when constructed" in {
|
||||
val routedActor = system.actorOf(Props(new TestActor).withRouting(NoRouter))
|
||||
val routedActor = system.actorOf(Props(new TestActor).withRouter(NoRouter))
|
||||
routedActor.isTerminated must be(false)
|
||||
}
|
||||
|
||||
|
|
@ -45,7 +45,7 @@ class RoutingSpec extends AkkaSpec with DefaultTimeout {
|
|||
}
|
||||
}
|
||||
|
||||
val routedActor = system.actorOf(Props(new Actor1).withRouting(NoRouter))
|
||||
val routedActor = system.actorOf(Props(new Actor1).withRouter(NoRouter))
|
||||
routedActor ! "hello"
|
||||
routedActor ! "end"
|
||||
|
||||
|
|
@ -57,7 +57,7 @@ class RoutingSpec extends AkkaSpec with DefaultTimeout {
|
|||
|
||||
"round robin router" must {
|
||||
"be started when constructed" in {
|
||||
val routedActor = system.actorOf(Props(new TestActor).withRouting(RoundRobinRouter(nrOfInstances = 1)))
|
||||
val routedActor = system.actorOf(Props(new TestActor).withRouter(RoundRobinRouter(nrOfInstances = 1)))
|
||||
routedActor.isTerminated must be(false)
|
||||
}
|
||||
|
||||
|
|
@ -85,7 +85,7 @@ class RoutingSpec extends AkkaSpec with DefaultTimeout {
|
|||
actors = actors :+ actor
|
||||
}
|
||||
|
||||
val routedActor = system.actorOf(Props(new TestActor).withRouting(RoundRobinRouter(targets = actors)))
|
||||
val routedActor = system.actorOf(Props(new TestActor).withRouter(RoundRobinRouter(targets = actors)))
|
||||
|
||||
//send messages to the actor.
|
||||
for (i ← 0 until iterationCount) {
|
||||
|
|
@ -123,7 +123,7 @@ class RoutingSpec extends AkkaSpec with DefaultTimeout {
|
|||
}
|
||||
})
|
||||
|
||||
val routedActor = system.actorOf(Props(new TestActor).withRouting(RoundRobinRouter(targets = List(actor1, actor2))))
|
||||
val routedActor = system.actorOf(Props(new TestActor).withRouter(RoundRobinRouter(targets = List(actor1, actor2))))
|
||||
|
||||
routedActor ! Broadcast(1)
|
||||
routedActor ! Broadcast("end")
|
||||
|
|
@ -138,7 +138,7 @@ class RoutingSpec extends AkkaSpec with DefaultTimeout {
|
|||
"random router" must {
|
||||
|
||||
"be started when constructed" in {
|
||||
val routedActor = system.actorOf(Props(new TestActor).withRouting(RandomRouter(nrOfInstances = 1)))
|
||||
val routedActor = system.actorOf(Props(new TestActor).withRouter(RandomRouter(nrOfInstances = 1)))
|
||||
routedActor.isTerminated must be(false)
|
||||
}
|
||||
|
||||
|
|
@ -161,7 +161,7 @@ class RoutingSpec extends AkkaSpec with DefaultTimeout {
|
|||
}
|
||||
})
|
||||
|
||||
val routedActor = system.actorOf(Props(new TestActor).withRouting(RandomRouter(targets = List(actor1, actor2))))
|
||||
val routedActor = system.actorOf(Props(new TestActor).withRouter(RandomRouter(targets = List(actor1, actor2))))
|
||||
|
||||
routedActor ! Broadcast(1)
|
||||
routedActor ! Broadcast("end")
|
||||
|
|
@ -175,7 +175,7 @@ class RoutingSpec extends AkkaSpec with DefaultTimeout {
|
|||
|
||||
"broadcast router" must {
|
||||
"be started when constructed" in {
|
||||
val routedActor = system.actorOf(Props(new TestActor).withRouting(BroadcastRouter(nrOfInstances = 1)))
|
||||
val routedActor = system.actorOf(Props(new TestActor).withRouter(BroadcastRouter(nrOfInstances = 1)))
|
||||
routedActor.isTerminated must be(false)
|
||||
}
|
||||
|
||||
|
|
@ -198,7 +198,7 @@ class RoutingSpec extends AkkaSpec with DefaultTimeout {
|
|||
}
|
||||
})
|
||||
|
||||
val routedActor = system.actorOf(Props(new TestActor).withRouting(BroadcastRouter(targets = List(actor1, actor2))))
|
||||
val routedActor = system.actorOf(Props(new TestActor).withRouter(BroadcastRouter(targets = List(actor1, actor2))))
|
||||
routedActor ! 1
|
||||
routedActor ! "end"
|
||||
|
||||
|
|
@ -229,7 +229,7 @@ class RoutingSpec extends AkkaSpec with DefaultTimeout {
|
|||
}
|
||||
})
|
||||
|
||||
val routedActor = system.actorOf(Props(new TestActor).withRouting(BroadcastRouter(targets = List(actor1, actor2))))
|
||||
val routedActor = system.actorOf(Props(new TestActor).withRouter(BroadcastRouter(targets = List(actor1, actor2))))
|
||||
routedActor ? 1
|
||||
routedActor ! "end"
|
||||
|
||||
|
|
@ -243,7 +243,7 @@ class RoutingSpec extends AkkaSpec with DefaultTimeout {
|
|||
"Scatter-gather router" must {
|
||||
|
||||
"be started when constructed" in {
|
||||
val routedActor = system.actorOf(Props(new TestActor).withRouting(ScatterGatherFirstCompletedRouter(targets = List(newActor(0)))))
|
||||
val routedActor = system.actorOf(Props(new TestActor).withRouter(ScatterGatherFirstCompletedRouter(targets = List(newActor(0)))))
|
||||
routedActor.isTerminated must be(false)
|
||||
}
|
||||
|
||||
|
|
@ -266,7 +266,7 @@ class RoutingSpec extends AkkaSpec with DefaultTimeout {
|
|||
}
|
||||
})
|
||||
|
||||
val routedActor = system.actorOf(Props(new TestActor).withRouting(ScatterGatherFirstCompletedRouter(targets = List(actor1, actor2))))
|
||||
val routedActor = system.actorOf(Props(new TestActor).withRouter(ScatterGatherFirstCompletedRouter(targets = List(actor1, actor2))))
|
||||
routedActor ! Broadcast(1)
|
||||
routedActor ! Broadcast("end")
|
||||
|
||||
|
|
@ -280,7 +280,7 @@ class RoutingSpec extends AkkaSpec with DefaultTimeout {
|
|||
val shutdownLatch = new TestLatch(1)
|
||||
val actor1 = newActor(1, Some(shutdownLatch))
|
||||
val actor2 = newActor(22, Some(shutdownLatch))
|
||||
val routedActor = system.actorOf(Props(new TestActor).withRouting(ScatterGatherFirstCompletedRouter(targets = List(actor1, actor2))))
|
||||
val routedActor = system.actorOf(Props(new TestActor).withRouter(ScatterGatherFirstCompletedRouter(targets = List(actor1, actor2))))
|
||||
|
||||
routedActor ! Broadcast(Stop(Some(1)))
|
||||
shutdownLatch.await
|
||||
|
|
|
|||
|
|
@ -526,7 +526,7 @@ class LocalActorRefProvider(
|
|||
val lookupPath = path.elements.drop(1).mkString("/", "/", "")
|
||||
deployer.lookup(lookupPath)
|
||||
}
|
||||
new RoutedActorRef(system, props.withRouting(router.adaptFromDeploy(depl)), supervisor, path)
|
||||
new RoutedActorRef(system, props.withRouter(router.adaptFromDeploy(depl)), supervisor, path)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -137,5 +137,5 @@ case class Props(creator: () ⇒ Actor = Props.defaultCreator,
|
|||
* Returns a new Props with the specified router config set
|
||||
* Java API
|
||||
*/
|
||||
def withRouting(r: RouterConfig) = copy(routerConfig = r)
|
||||
def withRouter(r: RouterConfig) = copy(routerConfig = r)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ class RandomRoutedRemoteActorMultiJvmNode4 extends AkkaRemoteSpec with DefaultTi
|
|||
"be locally instantiated on a remote node and be able to communicate through its RemoteActorRef" in {
|
||||
|
||||
barrier("start")
|
||||
val actor = system.actorOf(Props[SomeActor].withRouting(RoundRobinRouter()), "service-hello")
|
||||
val actor = system.actorOf(Props[SomeActor].withRouter(RoundRobinRouter()), "service-hello")
|
||||
actor.isInstanceOf[RoutedActorRef] must be(true)
|
||||
|
||||
val connectionCount = NrOfNodes - 1
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ class RoundRobinRoutedRemoteActorMultiJvmNode4 extends AkkaRemoteSpec with Defau
|
|||
"be locally instantiated on a remote node and be able to communicate through its RemoteActorRef" in {
|
||||
|
||||
barrier("start")
|
||||
val actor = system.actorOf(Props[SomeActor].withRouting(RoundRobinRouter()), "service-hello")
|
||||
val actor = system.actorOf(Props[SomeActor].withRouter(RoundRobinRouter()), "service-hello")
|
||||
actor.isInstanceOf[RoutedActorRef] must be(true)
|
||||
|
||||
val connectionCount = NrOfNodes - 1
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ class ScatterGatherRoutedRemoteActorMultiJvmNode4 extends AkkaRemoteSpec with De
|
|||
"be locally instantiated on a remote node and be able to communicate through its RemoteActorRef" in {
|
||||
|
||||
barrier("start")
|
||||
val actor = system.actorOf(Props[SomeActor].withRouting(RoundRobinRouter()), "service-hello")
|
||||
val actor = system.actorOf(Props[SomeActor].withRouter(RoundRobinRouter()), "service-hello")
|
||||
actor.isInstanceOf[RoutedActorRef] must be(true)
|
||||
//actor.asInstanceOf[RoutedActorRef].router.isInstanceOf[ScatterGatherFirstCompletedRouter] must be(true)
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ akka {
|
|||
"A Remote Router" must {
|
||||
|
||||
"deploy its children on remote host driven by configuration" in {
|
||||
val router = system.actorOf(Props[Echo].withRouting(RoundRobinRouter(2)), "blub")
|
||||
val router = system.actorOf(Props[Echo].withRouter(RoundRobinRouter(2)), "blub")
|
||||
router ! ""
|
||||
expectMsgType[ActorPath].toString must be === "akka://remote_sys@localhost:12346/remote/RemoteRouterSpec@localhost:12345/user/blub/c1"
|
||||
router ! ""
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ public class Pi {
|
|||
this.nrOfElements = nrOfElements;
|
||||
this.latch = latch;
|
||||
|
||||
router = this.getContext().actorOf(new Props().withCreator(Worker.class).withRouting(new RoundRobinRouter(5)), "pi");
|
||||
router = this.getContext().actorOf(new Props().withCreator(Worker.class).withRouter(new RoundRobinRouter(5)), "pi");
|
||||
}
|
||||
|
||||
// message handler
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ object Pi extends App {
|
|||
var start: Long = _
|
||||
|
||||
// create a round robin router for the workers
|
||||
val router = context.actorOf(Props(new Worker).withRouting(RoundRobinRouter(nrOfInstances = 5)), "pi")
|
||||
val router = context.actorOf(Props(new Worker).withRouter(RoundRobinRouter(nrOfInstances = 5)), "pi")
|
||||
|
||||
// message handler
|
||||
def receive = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue