簡體   English   中英

如何使用Akka Remote Actor正確關閉JVM

[英]how to properly shutdown JVM with akka remote actor

我正在嘗試使用Java API關閉非常簡單的akka​​ 1.2遠程參與者,如下所示:

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

但是,由於某些線程仍然掛出,JVM並未終止。

原因很簡單:您沒有停止遠程模塊。

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

這將正確停止一切。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM