简体   繁体   English

关闭远程akka actor连接?

[英]Closing a remote akka actor connection?

Is it possible, and/or necessary, to close a remote actor in akka? 是否有可能和/或有必要关闭akka中的远程角色?

I am able to start an akka.actor.ActorSystem as a "server" (in scala): 我可以将akka.actor.ActorSystem作为“服务器”启动(在scala中):

val actorSystem = ActorSystem("TestServer")

val actor = actorSystem.actorOf(..., name = "TestActor")

And then connect to it from a "client" ActorSystem running on a seperate JVM: 然后从运行在单独的JVM上的“客户端” ActorSystem连接到它:

remote = context.actorSelection("akka.tcp://TestServer@localhost:1234/user/TestActor")

I am able to send messages to remote and receive response messages. 我能够将消息发送到remote并接收响应消息。

However, when it's time for the client to shutdown I see the following log messages from the server ActorSystem after the client JVM is dead: 但是,当客户机关闭时,客户机JVM死后,我会从服务器ActorSystem看到以下日志消息:

[WARN] [04/01/2015 11:27:27.107] [TestServer-akka.remote.default-remote-dispatcher-5] ... [akka.tcp://ConsoleSystem@localhost:1236] has failed, address is now gated for [5000] ms. [WARN] [04/01/2015 11:27:27.107] [TestServer-akka.remote.default-remote-dispatcher-5] ... [akka.tcp:// ConsoleSystem @ localhost:1236]失败,地址现在被门控[5000] ms。 Reason is: [Disassociated] 原因是:[已取消关联]

Are these warnings bad? 这些警告不好吗? Is there some remote.closeConnection method I should be calling to prevent the warning messages? 我应该调用一些remote.closeConnection方法来防止出现警告消息吗?

Thank you in advance. 先感谢您。

This warning is not bad in your test example. 在您的测试示例中,此警告还不错。 But it is necessary to warn you if remote system, that associated to your system is dissasociated (shutted down, connection lost, etc.) 但是,如果与您的系统关联的远程系统已断开(关闭,连接断开等),则有必要警告您。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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