0 Replies Latest reply on Oct 29, 2007 9:43 AM by Jan Ziegler

    Concurrent ajax-requests and synchronization of the view sta

    Jan Ziegler Newbie

      I posted a scenario of concurrent requests and view tree synchronization in the user forum an got no answer. Maybe the question is better addressed to the developers.

      This is the url to the original post:
      http://jboss.com/index.html?module=bb&op=viewtopic&p=4099837#4099837

      And this is what it´s about in short:

      Think about a scenario where one performs 2 jsf requests to the same view (e.g. /index.xhtml) via ajax in parallel. This can easily be done by using a4j:function or a4j:poll.
      Let´s say both request arrive nearly at the same time on server side so they refer to the same view tree which is restored in RESTORE_VIEW phase at the beginning of the lifecyle.

      Now during lifecycle both request modify the view programatically in action- or action listener methods concurrently.

      At the end of each request, the response is rendered and after that (or between) the state of the view root is stored to the session (in STATE_SAVING_METHOD=server) by the AjaxStateManager in the form of viewID=state.

      When I look into the code this happens via the method saveStateInSession().

      But at this point their seems to be no "merging" between modifications made to the view tree in parallel. So the slower request of both is the last one saving the state of the view tree and therefor overwriting the modifications made by the faster request, which completed before.

      Should this be the normal behavior for parallel requests changing state on the same view tree?

      It´s hard to find anything in the web how this is handled in generall in JSF but I think it becomes really important when using ajax.

      So any ideas / comments on this?