Parallel execution of async command actions

Hi,

Is it possible to run async commands actions in parallel?
Suppose we have a portlet with 2 panels, where will be showing data from two different web services.
Each of these web services takes 60 secs to return the data. On click of a button we’ll raise two async commands each one for one web service.
What I see in mws console is that it serializes the requests as they they reach it. First In, first out.
How can I build the portlet so that the web services execute in parallel?

Thanks
Bruno

No, not really. Since both of your async command actions would be operating on the same managed bean objects, there would be a risk of data update collisions if both were allowed to execute concurrently.

There are a couple of options:

  1. Do both the webservice calls with a single async command request.

  2. Have the async command handlers spawn worker threads to do the the webservice calls in the background on the server side. When the worker threads complete their activity, you could raise an OpenAjax event to notify the client that the data is ready. The client-side OpenAjax event subscription would respond to the event by refreshing the controls from your portlet to render the webservice results.

Hi,

is there a sample showing how to do option 2?

thanks
Bruno