I wrote a code sample that launches an actor, kills it, and finishes executing.
object PureAkka {
def main(argv : Array[String]) = {
val actorSystem : ActorSystem = ActorSystem("main")
val actor : ActorRef = actorSystem.actorOf(Props( new Actor {
override def receive = {
case x => println(x)
}
override def preStart() = println("prestart")
override def postStop() = println("poststop")
} ) )
Thread.sleep(15000)
actor ! PoisonPill
}
}
This code prints:
[info] prestart
[info] poststop
But he refuses to stop until I kill the process with Ctrl-C
What awaits the application? How can I stop it properly?
source
share