hmm.... lets say you have an actor that, for each message, spawns a worker actor and calculates the Number for you (and whatever else you need that is parallelizable), which you can query with something like:
val theNum = ask(myActor, new MyMessage(i, j))
MyMessage is just a case class you define in the companion object to MyActor:
case class MyMessage(i: Int, j: Int)
ok, that's nice, now we can do (off the top of my head, may have bugs):
val myNums =
for(i <- 0 until ca1.length) yield {
for(j <- 0 until ca2.length) yield {
theNum <- ask(myActor, new MyMessage(i, j)).mapTo[Number]
}
}
So your results can be grabbed thusly: (using Await for simplicity, not because I like it):
val result = Await.result(myNums, 10 seconds).flatten.asInstanceOf[Seq[Number]]
Now you'll want to foreach over the result, do your printing/logging and adding of numbers to your "sheet" (whatever that is) -- assuming you didn't take care of that in the actor (depends on what your sheet is and what you need, I suppose).
Note: you could also make myActor a router by doing something like:
val myActor = context.actorOf(Props[MyActor].withRouter( RoundRobinRouter(nrOfInstances = 10))