Re: RMI callback on exist socket connection.
lambliu <[email protected]>
| Newsgroups | gmane.comp.java.sun.rmi |
|---|---|
| Message-ID | <[email protected]> |
Thanks , That's really a charming idea. Lamb Eamonn McManus wrote: > Lamb, > > One possibility is for the client to repeatedly call a remote method > on the server. This method blocks until the server has something it > wants the client to do. Then it returns to the client an indication > of what that is, the client does it, and then calls the method again. > Depending on what you want to do this could suffice. > > We use this technique in the JMX Remote API to deliver asynchronous > notifications from server to client. The client calls a remote method > fetchNotifications in the server. That method blocks until > notifications arrive, whereupon it returns them to the client. The > client dispatches them, then calls fetchNotifications again. > > If you use this technique, it is probably a good idea to have the > blocking method return occasionally even if there is nothing for the > client to do. Otherwise, if the client dies, the server won't notice > until the method does need to return. In the meantime, the ongoing > method call will prevent the remote object from being garbage-collected. > > Regards, > Éamonn McManus JMX Spec Lead http://weblogs.java.net/blog/emcmanus/ > > > lamb liu wrote: > >> Generally, if I want to initiate callback from RMI server to a >> client(for notification, etc...) >> I need to export the client object , >> Thus JDK will try to setup another socket on the server to connect back. >> This method will incur many problem especially when client is behind >> a proxy. >> >> I wonder if it is another method to implement callback on established >> connection. >> In theory, it is possible, since this connection is full duplex >> connection, thus server >> can send data back. >> But I never found clear implementation on this issue. >> Sun's RMI faq points out: it is not normally possible. So how can I >> do it abnormally? >> Does a solution exist?Or I must do it by myself? >> >> Lamb. >> >> =========================================================================== To unsubscribe, send email to [email protected] and include in the body of the message "signoff RMI-USERS". For general help, send email to [email protected] and include in the body of the message "help". For a list of frequently asked RMI questions please refer to: http://java.sun.com/j2se/1.3/docs/guide/rmi/faq.html To view past RMI-USERS postings, please see: http://archives.java.sun.com/archives/rmi-users.html