简体   繁体   中英

how to properly shutdown JVM with akka remote actor

I'm trying to shutdown a very simple akka 1.2 remote actors with the Java API like this:

public static void main(String[] args) {
    Actors.remote().start("localhost", 2552);
    Actors.registry().shutdownAll();
}

But the JVM isn't terminated because of some threads still hang out.

The reason is simple: you did not stop the remote module.

public static void main(String[] args) {
  Actors.remote().start("localhost", 2552);
  Actors.registry().shutdownAll();
  Actors.remote().shutdown();
}

This will properly stop everything.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM