Skip to content

Instantly share code, notes, and snippets.

@privateblue
Last active December 26, 2015 04:59
Show Gist options
  • Save privateblue/7097415 to your computer and use it in GitHub Desktop.
Save privateblue/7097415 to your computer and use it in GitHub Desktop.
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