액터를 시작하고 액터를 시작하고 실행을 종료하는 샘플 코드를 작성했습니다.올바르게 스칼라에서 akka 액터를 종료하십시오.
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
}
}
이 코드를 인쇄 :
[info] prestart
[info] poststop
그러나 내가 Ctrl-C를
어떤 애플리케이션 대기 않습니다와 프로세스를 종료 할 때까지 중단하기를 거부? 적절한 방법으로 어떻게 멈출 수 있습니까?
Akka 설명서는 http://doc.akka.io/api/akka/2.0.3/#akka.actor.Actor에서 'context.stop'이라고 말하면 도움이 될 수 있습니다. –