The following code: Welcome to Scala 2.12.0 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_112). Type in expressions for evaluation. Or try :help.
scala> import akka.actor._; import scala.concurrent._; import duration._ import akka.actor._ import scala.concurrent._ import duration._ scala> :paste // Entering paste mode (ctrl-D to finish) val s = ActorSystem("test") def onTerm = { println("Waiting...") Await.result(s.whenTerminated, Duration.Inf) println("Fin!") } s.registerOnTermination(onTerm) // Exiting paste mode, now interpreting. s: akka.actor.ActorSystem = akka://test onTerm: Unit scala> s.terminate res1: scala.concurrent.Future[akka.actor.Terminated] = Future(<not completed>) scala> Waiting... At this point the future doesn't terminate. Looking at the documentation of *whenTerminated*; "Returns a Future which will be completed after the ActorSystem has been terminated and termination hooks have been executed". It's probably a good idea to indicate on the *registerOnTermination* method that it's dangerous to wait on the whenTerminated future from the callback. Chris -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user --- You received this message because you are subscribed to the Google Groups "Akka User List" group. To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+unsubscr...@googlegroups.com. To post to this group, send email to akka-user@googlegroups.com. Visit this group at https://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.