如何识别远程演员? [英] How can I identify a remote actor?

查看:96
本文介绍了如何识别远程演员?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个远程参与者(客户端),正在向另一个远程参与者(服务器)注册,然后注销(带有关闭挂钩)。但是,尽管服务器取消注册,但是实际的 发件人 属性是不同的Channel对象;所以在我的服务器日志中,我有:

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:


注册新客户端[scala.actors.Channel@158e282];支持1个客户端

注销的客户端[scala.actors.Channel@1caf0b6];支持1个客户端

我如何确定(在服务器端)这是同一位客户端参与者最初向我注册的是哪个?显然,我可以给每个客户端使用自己的 UUID ,但是我想知道是否有更简单的方法吗?

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?

推荐答案

从对scala用户邮件列表的讨论来看,如果不使用某些替代类型的客户端标识符(例如 UUID )。如果从客户端在注册对象中发送自己引用,则会出现 ObjectNotSerializable 错误。

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 the self reference from the client in your registration object, you will get a ObjectNotSerializable error.

这篇关于如何识别远程演员?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆