After some time this actor fills out stack. Possible solutions ?
object Puller extends Actor {
def act() = {
receiveWithin(2000) {
case Stop => println("stoping puller")
exit()
case Noop => println("nothing happens")
act()
case TIMEOUT => doPull
act()
}
}
def doPull() = // stuff...
}
I’m unhappy to find this code in Programming in Scala.
Your
actis not tail-recursive. You can modify it as follows: