Untitled


SUBMITTED BY: Guest

DATE: Feb. 6, 2013, 5:59 p.m.

FORMAT: Text only

SIZE: 528 Bytes

HITS: 1363

  1. class Ping(count: int, pong: Actor) extends Actor {
  2. def act() {
  3. var pingsLeft = count - 1
  4. pong ! Ping
  5. while (true) {
  6. receive {
  7. case Pong =>
  8. if (pingsLeft % 1000 == 0)
  9. Console.println("Ping: pong")
  10. if (pingsLeft > 0) {
  11. pong ! Ping
  12. pingsLeft -= 1
  13. } else {
  14. Console.println("Ping: stop")
  15. pong ! Stop
  16. exit()
  17. }
  18. }
  19. }
  20. }
  21. }

comments powered by Disqus