使用java rmi的优点和缺点
RMI 的优点和缺点是什么?
What are the advantages and disadvantages of RMI?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
RMI 的优点和缺点是什么?
What are the advantages and disadvantages of RMI?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
其优点和缺点与任何类似 RPC(远程过程调用)系统的优点和缺点类似。表面上看起来很简单,因为实际上远程的对象可以被视为本地对象。
这似乎对简化编程有很大好处,但也存在隐性成本。分布式系统存在延迟问题和潜在的部分故障,程序员必须意识到这些问题。远程方法的调用可能会因安全、延迟问题、网络故障等而出现潜在的故障。掩盖此类问题可能会对可靠性造成灾难。
The advantages and disadvantages are similar to those of any RPC-like (Remote Procedure Call) System. There is a superficial appearance of simplicity, because it objects which are in fact remote can be treated as though they were local.
This would seem like a great benefit to simplicity of programming, but there are hidden costs. Distributed systems have issues of latency and potential for partial failure which the programmer has to be aware of. An invocation of a remote method is subject to potential failure from security, latency problems, network failure, etc. Papering over these sorts of problems can be a disaster for reliability.
根据我的经验:
优点:
您可以实现两个接口,如下所示:
通用任务接口:
Rmi 接口:
服务器端的
RmiTask
实现:示例客户端
Task
实现:缺点:
PassedObject
上调用method()
,但是了不起的客户端可以覆盖这个方法并执行他想要的任何东西...From my experience:
Pros:
You can implement two interfaces like that:
Common task interface:
Rmi interface:
RmiTask
implementation on server side:Example client
Task
implementation:Cons:
method()
onPassedObject
, but marvellous client could override this method and execute whatever he wants there...Callable
s and run them with defined timeouts).