Well, he overflows the stacks for very obvious reasons; it is recursive, but not recursive. There are two options here:
Or : use a while loop:
def act() =
while(true) {
receiveWithin(2000) {
case Stop => println("stoping puller"); exit()
case Noop => println("nothing happens")
case TIMEOUT => doPull
}
}
Or : use loopand react(which has the added benefit of being scalable by disabling the actor from hanging one thread).
def act() =
loop {
reactWithin(2000) {
case Stop => println("stoping puller"); exit()
case Noop => println("nothing happens")
case TIMEOUT => doPull
}
}
Scala, , . , , , act.