users@glassfish.java.net

Recommended way to handle callbacks with a Swing Client connecting to EJBs?

From: <glassfish_at_javadesktop.org>
Date: Wed, 19 Mar 2008 18:41:13 PST

It is very easy to write an RMI application where the Swing client can pass a handle to one of its exported objects to a server to allow the server to send asynchronous responses to the Swing client. The server will likely send data to the Swing client from another thread (such as a worker processing events from a data event queue and notifying listeners of the data event.)

Since multi-threaded programming within a Session Bean isn't done, the only way I've come up with to do this kind of thing is to have the Session Bean cache the handle in a place that a MDB can get to it or send it to a MDB in a JMS event so that the MDB can cache it and then a MDB would send the asynchronous events to the Swing client using the cached handle.

Is this the only way to do this kind of thing using Glassfish?

Does anybody have some recommendations on best practices for this type of problem?


(As a side note: Ideally RMI would support bidirectional callbacks as well to allow easier penetration of firewalls without polling.)
[Message sent by forum member 'rrr6399' (rrr6399)]

http://forums.java.net/jive/thread.jspa?messageID=264916