Last active
December 26, 2015 04:59
-
-
Save privateblue/7097415 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import akka.actor.{ ActorSystem, Actor, Props } | |
class HelloWorld { | |
def foobar = println(Thread.currentThread().getName()) | |
} | |
object Test { | |
class TestActor(hw: HelloWorld) extends Actor { | |
def receive = { | |
case _ => hw.foobar | |
} | |
} | |
val system = ActorSystem("Test-Actor-System") | |
def main(args: Array[String]) = { | |
val hw = new HelloWorld | |
hw.foobar | |
val actor = system.actorOf(Props(classOf[TestActor], hw), "test-actor") | |
actor ! "dosomething" | |
system.shutdown | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment