Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Week 38: Actor System Termination on JVM Shutdown #57

Open
shekhargulati opened this issue Sep 20, 2016 · 3 comments
Open

Week 38: Actor System Termination on JVM Shutdown #57

shekhargulati opened this issue Sep 20, 2016 · 3 comments

Comments

@shekhargulati
Copy link
Owner

Please provide your feedback by posting a comment against this issue.

@jotomo
Copy link

jotomo commented Sep 23, 2016

Line 145: This meant App1ControlActor can successfully does not have to wait for JVM to exit.

Missing shut down and between successfully and does not

@shekhargulati
Copy link
Owner Author

@jotomo thanks. I have incorporated the feedback.

@bszwej
Copy link

bszwej commented Oct 16, 2016

Hi,
you could have used sys.addShutdownHook from scala.sys package object which is a nice scala wrapper over java Runtime.getRuntime.addShutdownHook.

So basically instead of this:

Runtime.getRuntime.addShutdownHook(new Thread(new Runnable {
    override def run(): Unit = {
      val terminate: Future[Terminated] = system.terminate()
      Await.result(terminate, Duration("10 seconds"))
    }
  }))

you can do this:

  sys.addShutdownHook {
    val terminate: Future[Terminated] = system.terminate()
    Await.result(terminate, Duration("10 seconds"))
  }

which looks nicer (less boilderplate) ;).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants