Vote count:
0
I have found this code example, that is part of a "web crawler" written in Scala:
def getPageSizeConcurrently() = {
val caller = self
for (url <- urls) {
actor { caller ! (url, PageLoader.getPageSize(url)) }
}
for (i <- 1 to urls.size) {
receive {
case (url, size) =>
println(url + ": " + size)
case _ =>
println("Shouldn't happen")
}
}
}
I want to know if I am getting it right.
The second line "var caller = self" is that something equal to erlangs self(), which is returning a PID?
The fifth line that starts with actor, is that creating a new actor-process that is sending a message to the PID caller with a tupel (url, PageLoader.getPageSize(url))?
asked 41 secs ago
Aucun commentaire:
Enregistrer un commentaire