Merge branch 'master' into 1495-routees-message-he

Conflicts:
	akka-actor/src/main/scala/akka/routing/Routing.scala
This commit is contained in:
Henrik Engstrom 2011-12-20 11:18:37 +01:00
commit c92f3c5ca2
57 changed files with 1078 additions and 567 deletions

View file

@ -105,7 +105,7 @@ class RoutingSpec extends AkkaSpec(ConfigFactory.parseString("""
}
"send message to connection" in {
val doneLatch = new CountDownLatch(1)
val doneLatch = new TestLatch(1)
val counter = new AtomicInteger(0)
@ -120,7 +120,7 @@ class RoutingSpec extends AkkaSpec(ConfigFactory.parseString("""
routedActor ! "hello"
routedActor ! "end"
doneLatch.await(5, TimeUnit.SECONDS) must be(true)
Await.ready(doneLatch, 5 seconds)
counter.get must be(1)
}
@ -139,7 +139,7 @@ class RoutingSpec extends AkkaSpec(ConfigFactory.parseString("""
"deliver messages in a round robin fashion" in {
val connectionCount = 10
val iterationCount = 10
val doneLatch = new CountDownLatch(connectionCount)
val doneLatch = new TestLatch(connectionCount)
//lets create some connections.
var actors = new LinkedList[ActorRef]
@ -167,7 +167,7 @@ class RoutingSpec extends AkkaSpec(ConfigFactory.parseString("""
routedActor ! Broadcast("end")
//now wait some and do validations.
doneLatch.await(5, TimeUnit.SECONDS) must be(true)
Await.ready(doneLatch, 5 seconds)
for (i 0 until connectionCount) {
val counter = counters.get(i).get
@ -176,7 +176,7 @@ class RoutingSpec extends AkkaSpec(ConfigFactory.parseString("""
}
"deliver a broadcast message using the !" in {
val doneLatch = new CountDownLatch(2)
val doneLatch = new TestLatch(2)
val counter1 = new AtomicInteger
val actor1 = system.actorOf(Props(new Actor {
@ -199,7 +199,7 @@ class RoutingSpec extends AkkaSpec(ConfigFactory.parseString("""
routedActor ! Broadcast(1)
routedActor ! Broadcast("end")
doneLatch.await(5, TimeUnit.SECONDS) must be(true)
Await.ready(doneLatch, 5 seconds)
counter1.get must be(1)
counter2.get must be(1)
@ -214,7 +214,7 @@ class RoutingSpec extends AkkaSpec(ConfigFactory.parseString("""
}
"deliver a broadcast message" in {
val doneLatch = new CountDownLatch(2)
val doneLatch = new TestLatch(2)
val counter1 = new AtomicInteger
val actor1 = system.actorOf(Props(new Actor {
@ -237,7 +237,7 @@ class RoutingSpec extends AkkaSpec(ConfigFactory.parseString("""
routedActor ! Broadcast(1)
routedActor ! Broadcast("end")
doneLatch.await(5, TimeUnit.SECONDS) must be(true)
Await.ready(doneLatch, 5 seconds)
counter1.get must be(1)
counter2.get must be(1)
@ -251,7 +251,7 @@ class RoutingSpec extends AkkaSpec(ConfigFactory.parseString("""
}
"broadcast message using !" in {
val doneLatch = new CountDownLatch(2)
val doneLatch = new TestLatch(2)
val counter1 = new AtomicInteger
val actor1 = system.actorOf(Props(new Actor {
@ -273,14 +273,14 @@ class RoutingSpec extends AkkaSpec(ConfigFactory.parseString("""
routedActor ! 1
routedActor ! "end"
doneLatch.await(5, TimeUnit.SECONDS) must be(true)
Await.ready(doneLatch, 5 seconds)
counter1.get must be(1)
counter2.get must be(1)
}
"broadcast message using ?" in {
val doneLatch = new CountDownLatch(2)
val doneLatch = new TestLatch(2)
val counter1 = new AtomicInteger
val actor1 = system.actorOf(Props(new Actor {
@ -304,7 +304,7 @@ class RoutingSpec extends AkkaSpec(ConfigFactory.parseString("""
routedActor ? 1
routedActor ! "end"
doneLatch.await(5, TimeUnit.SECONDS) must be(true)
Await.ready(doneLatch, 5 seconds)
counter1.get must be(1)
counter2.get must be(1)
@ -341,7 +341,7 @@ class RoutingSpec extends AkkaSpec(ConfigFactory.parseString("""
routedActor ! Broadcast(1)
routedActor ! Broadcast("end")
doneLatch.await
Await.ready(doneLatch, TestLatch.DefaultTimeout)
counter1.get must be(1)
counter2.get must be(1)
@ -354,7 +354,7 @@ class RoutingSpec extends AkkaSpec(ConfigFactory.parseString("""
val routedActor = system.actorOf(Props[TestActor].withRouter(ScatterGatherFirstCompletedRouter(routees = List(actor1, actor2))))
routedActor ! Broadcast(Stop(Some(1)))
shutdownLatch.await
Await.ready(shutdownLatch, TestLatch.DefaultTimeout)
Await.result(routedActor ? Broadcast(0), timeout.duration) must be(22)
}