如何使用Java RMI实现Observer模式? [英] How to implement the Observer pattern with Java RMI?

查看:156
本文介绍了如何使用Java RMI实现Observer模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个客户端在服务器上启动一个长时间运行的进程。我会定期向用户展示后台正在发生的事情。最简单的方法是轮询服务器,但我想知道是否没有办法为此实现Observer模式。不幸的是,我正在使用RMI与服务器通信,我担心我必须将我的客户端变为RMI服务器。

I have a client that starts a long running process on the server. At regular intervals, I'd like to show the user what's happening in the background. The most simple approach is to poll the server but I'm wondering if there wasn't a way to implement the Observer pattern for this. Unfortunately, I'm using RMI to talk to the server and I fear that I have to turn my client into an RMI server for this.

还有另外一种方法吗?我失踪了?

Is there another way that I'm missing?

推荐答案

http://sites.google.com/site/jamespandavan/Home/java/sample-remote-observer-based-on-rmi

这篇关于如何使用Java RMI实现Observer模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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