Search code examples
javascalaakkaakka-remote-actor

Closing a remote akka actor connection?


Is it possible, and/or necessary, to close a remote actor in akka?

I am able to start an akka.actor.ActorSystem as a "server" (in 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:

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

I am able to send messages to remote and receive response messages.

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:

[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. Reason is: [Disassociated]

Are these warnings bad? Is there some remote.closeConnection method I should be calling to prevent the warning messages?

Thank you in advance.


Solution

  • 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.)