Hello!
I've searched through lots of webpages about J2EE design patterns, but I could
not find any satisfying answer to my problem concerning "continuous loading".
The only design pattern that almost fits is the value-list-handler (also called
page-by-page pattern) - but I think it is not the best way to do what I want:
My client is a rich client (implemented with Eclipse RCP) accessing an EJB
application on JBoss Application Server 4.x (using EJB 3.0).
Very often the clients shows lists (and trees) containing data (merely lists of
Tranfer Objects) from the server. To enhance UI-responsiveness on the client,
it would be nice, if I could fetch the data from the server in a continous
stream and so populate the list asynchronous instead of waiting until all items
are deserialized on the client (the list often contains more than 1000
elements).
So what I need is something like a "Remote Iterator Pattern". My suggestion:
A stateless session bean implements the query-methods, but does not return the
result directly, but a reference to a stateful session bean that is able to
iterate over the result.
| // lookup stateless session bean
| QuerySession querySession = (QuerySession)ctx.lookup("querySession");
|
| // Execute query. The result is a stateful session bean that acts as
iterator
| RemoteIterator remoteResult = querySession.findItemsByName("*");
| // Iterate over the remote(!) result:
| while (remoteResult.hasNext()) {
| // fetch another 10 items
| Item[] items = (Item[])remoteResult.fetchNext(10);
| // process items here (e.g. populate UI-list)
| }
| remoteResult.done(); // removes stateful session bean
|
I'm not sure if this approach works. How do I implement my QuerySession and
RemoteIterator interfaces? Is it possible to have a generic RemoteIterator
implementation that is initialized within the finder-method, or do I have to
implement one class per finder-method (e.g. an FindItemsByNameRemoteIterator)?
Thanks in advance,
Tex
P.S.: Please have in mind I'm using EJB 3.0.
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3872134#3872134
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3872134
-------------------------------------------------------
This SF.net email is sponsored by Demarc:
A global provider of Threat Management Solutions.
Download our HomeAdmin security software for free today!
http://www.demarc.com/info/Sentarus/hamr30
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user