I have a remote actor (client) which is registering with another remote actor (server) and then later deregistering (with a shutdown hook). However, although the server picks up the de-registration, the actual sender
property is a different Channel object; so in my server logs I have:
Registered new client [scala.actors.Channel@158e282]; supporting 1 clients
De-registered client [scala.actors.Channel@1caf0b6]; supporting 1 clients
How can I determine (on the server side) that this was the same client actor which originally registered with me? Obviously I could imbue each client with its own UUID
but I wonder whether there is an easier way?
From a discussion on the scala users' mailing list, it seems that this is not immediately possible without using some alternative kind of client identifier (like
UUID
). If you send theself
reference from the client in your registration object, you will get aObjectNotSerializable
error.Explicitly add the sender to your message. Use RemoteActor.select to get a scala.actors.remote.Proxy. Use its toString method to identify the sender.