tags:

views:

523

answers:

2

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?

+1  A: 

I don't think you're missing anything. The only two ways are to either periodically call the server and check the status (polling) or register a callback which the server periodically calls (your client must expose a method). IMO, polling is a perfectly reasonable way to handle this.

tvanfosson
+2  A: 

RMI can in general support two way communication. (And yeah, RMI is a PITA to set up, and do anything else with.)

However, the HTTP transport that works over a CGI script(!) does not support it.

Tom Hawtin - tackline
Is that still true when I start the server in my code with LocateRegistry.createRegistry() (instead of using the executable supplied by Sun)?
Aaron Digulla