This content has been marked as final. Show 6 replies
another sugestion is a JMS:http://jobinesh.blogspot.com.es/2011/04/using-jms-with-adf-business-components.html
but I recommend minimize the time of query, because is not a best practice having to wait minutes in a web application
I would try the asynchrous WS to trigger the long running query and then use a af:poll to update the table on the UI.
You don't have to populate the results but only have to start the query via the WS. You then wait for hte query to finish and the poll component will eventually show the data.
That idea sounds promising, thanks. Would you mind expanding on it slightly please?
You say the asynchronous WS does not populate the data but simply triggers the query - how does it achieve this? Can it interact with the view object? Also, what mechanism would it use to indicate that the query has finished?
Thanks for the reply.
I knew someone would say make the query quicker ;) Assuming it is already as quick as it can be and an acceptable speed for the application...
I've not come across JMS before but looking at the link, will it have a similar problem to the threaded approaches in accessing the application module? Also, the example uses Weblogic features, I'd need to check Glassfish has similar.
If your backend is db, there is no such thing as asynchronous jdbc call.
So, you will need to use thread(or to use some technology which will use thread instead of you :) )
But, problem is that threads and webapps don't play nicely.
Maybe you can generate some token(or use username) and trigger some background app which will execute long running query and populate some table with query result(and add token to each row - or you can use two tables: master which contain token, and detail which contain results for this token)
Then in your app, you can use af:poll to periodically check this new table (query will be restricted by given token - and this should be fast because this will be simple select)
It seems that plans are afoot through [url http://jcp.org/en/jsr/detail?id=236]JSR 236 to add this functionality to Java EE in the form of container managed concurrency facilities. See the [url http://download.oracle.com/otndocs/jcp/concurrency_utilities-1_0-edr-spec/index.html]Early Draft Review.
In the meantime I've implemented a bean to manage query threads and an af:poll component to check for their completion.
Thanks to all for your suggestions.