2011-03-15 01:00:02 +01:00
|
|
|
package akka.ticket
|
|
|
|
|
|
|
|
|
|
import akka.actor.Actor._
|
|
|
|
|
import akka.actor._
|
|
|
|
|
import akka.routing._
|
|
|
|
|
import org.scalatest.WordSpec
|
|
|
|
|
import org.scalatest.matchers.MustMatchers
|
|
|
|
|
|
|
|
|
|
class Ticket703Spec extends WordSpec with MustMatchers {
|
|
|
|
|
|
2011-06-13 13:43:21 +02:00
|
|
|
"A ? call to an actor pool" should {
|
2011-03-15 01:00:02 +01:00
|
|
|
"reuse the proper timeout" in {
|
2011-05-18 17:25:30 +02:00
|
|
|
val actorPool = actorOf(
|
2011-07-15 14:25:09 -07:00
|
|
|
new Actor with DefaultActorPool with DefaultActorPoolSupervisionConfig with BoundedCapacityStrategy with MailboxPressureCapacitor with SmallestMailboxSelector with BasicNoBackoffFilter {
|
2011-05-18 17:25:30 +02:00
|
|
|
def lowerBound = 2
|
|
|
|
|
def upperBound = 20
|
|
|
|
|
def rampupRate = 0.1
|
|
|
|
|
def partialFill = true
|
|
|
|
|
def selectionCount = 1
|
|
|
|
|
def instance = factory
|
|
|
|
|
def receive = _route
|
|
|
|
|
def pressureThreshold = 1
|
|
|
|
|
def factory = actorOf(new Actor {
|
|
|
|
|
def receive = {
|
|
|
|
|
case req: String ⇒
|
|
|
|
|
Thread.sleep(6000L)
|
|
|
|
|
self.reply_?("Response")
|
|
|
|
|
}
|
|
|
|
|
})
|
2011-04-12 09:55:32 +02:00
|
|
|
}).start()
|
2011-06-14 14:26:13 +02:00
|
|
|
(actorPool.?("Ping", 7000)).await.result must be === Some("Response")
|
2011-03-15 01:00:02 +01:00
|
|
|
}
|
|
|
|
|
}
|
2011-06-14 00:19:54 +02:00
|
|
|
}
|