Advertisement
Guest User

Untitled

a guest
Dec 1st, 2015
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1.  
  2. import akka.actor.{Actor, Props, ActorSystem}
  3.  
  4. class ExampleActor extends Actor {
  5.  
  6. def receive = {
  7. case i: Int =>
  8. println(i.toString)
  9. Thread.sleep(10000)
  10.  
  11. case _ =>
  12. }
  13.  
  14. }
  15.  
  16. object ExampleActor {
  17. lazy val system = ActorSystem("exampleSystem")
  18.  
  19. def newInstance = system.actorOf(Props(new ExampleActor))
  20.  
  21. def test(): Unit = {
  22. 1 to 100 foreach { i =>
  23. newInstance ! i
  24. }
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement