[
https://jira.jboss.org/jira/browse/RF-5955?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12451372#action_12451372
]
Nick Belaevski commented on RF-5955:
------------------------------------
Looks like the concurrent access issue.
Please use client-side events queue (either by specifying eventsQueue attribute
or by declaring view/form scoped queue) and dispatcher bean on server that will
control re-rendering (you can do that by specifying
reRender="#{bean.elementsToUpdate}")
> a4j push fails(sometimes) to rerender target component
> ------------------------------------------------------
>
> Key: RF-5955
> URL: https://jira.jboss.org/jira/browse/RF-5955
> Project: RichFaces
> Issue Type: Bug
> Affects Versions: 3.3.0
> Environment: JBoss AS: 4.2.2 GA
> JBoss Seam: 2.1.1GA
> JBoss RichFaces: 3.3.0 GA
> OS: Windows XP
> Browser: Firefox 3.0.5 and IE 7
> Reporter: Atul Kshirsagar
>
> a4j push tag fails to reRender the target component (specified in reRender
> attribute) sometimes.
> In our project we are using a4j:push tag to dynamically refresh certain
> portions of our web page depending upon events generated on server side. The
> problem that I am seeing is that some times (not always) a4j push does not
> reRender the target id specified even though PushEventListener is notified of
> an Event.
> Note that I have 8 a4j push tags refreshing different components on our web
> page and we can see burst of events (approx 200 events in less than 1 min).
> Below given is the example code:
> xhtml that uses a4j:push tag:
> <a4j:push reRender="myTableId" eventProducer="#{myBean.addListener}"
> interval="10000"
> ignoreDupResponses="true"
> action="#{mybean.populateViewModel}"/>
> <rich:dataTable id="myTableId" value="#{myBean.data}" var="_data">
> <rich:column>
> <h:outputText value="#{_data.name}" />
> </rich:column>
> </rich:dataTable>
>
> Backing bean definition is as follows:
> @Stateful
> @Local( {
> MyBeanLocal.class
> })
> @Name("myBean")
> @Scope(ScopeType.SESSION)
> @Restrict("#{identity.loggedIn}")
> public class MyBean implements MyBeanLocal, Serializable {
> @EJB
> private MyEJB ejb;
> private MyBeanListener eventListener;
> /**
> * DataModel
> */
> private List<Data> data;
>
> public List<Data> getData() {
> return this.data;
> }
> @Create
> public void create() {
> this.data = new ArrayList<Data>();
> populateViewModel();
> }
> // destroy method de-registers the listener from DataModel
> @Remove
> @Destroy
> public void destroy() {
> DataModel dataModel = ejb.getDataModel();
> if (dataModel != null) {
> dataModel.removeChangeListener(eventListener);
> }
> }
> /**
> * Adds listener for conveying AJAX events.
> *
> * @param listener
> */
> public void addListener(EventListener listener) {
> DataModel dataModel = ejb.getDataModel();
> eventListener = new MyBeanListener();
> eventListener.addListener(listener);
> dataModel.addChangeListener(eventListener);
> }
> /**
> * Constructs the view data model required for the link utilization widget
> on dashboard
> */
> public void populateViewModel() {
> data.clear();
> DataModel dataModel = ejb.getDataModel();
> data = dataModel.getData();
> }
> }
> public class MyBeanListener implements Serializable {
> private PushEventListener listener;
> public void addListener(EventListener l) {
> this.listener = (PushEventListener)l;
> }
> public void dataChanged() {
> listener.onEvent(new EventObject(this));
> }
> }
>
> public class DataModel implements MessageListener {
> private List<MyBeanListener> listeners;
>
> public void addChangeListener(MyBeanListener l) {
> listeners.add(l);
> }
> public void removeChangeListener(MyBeanListener l) {
> listeners.remove(l);
> }
> public void fireEvent() {
> for (MyBeanListener l: listeners) {
> l.dataChanged();
> }
> }
> // This method is called on JMS message
> public void onMessage(Message message) {
> // update internal data structure and then notify listeners
> fireEvent();
> }
> }
> So what is happening here is that class MyBean is SFSB and registers
> MyBeanListener with DataModel when addListener is called (by virtue of
> eventProducer attribute of a4j:push). DataModel is a JMS listener and upon
> receiving JMS message it notifies the registered listener of change in data.
> What I am seeing here is that all the above described flow happens and
> a4j:push gets notified of the event (I verified this by checking that
> populateViewData method of MyBean gets called) but the reRender of
> 'myTableId' component does not happen (this happens only intermittently...e.g
> If I repeat the test for about 4 to 5 times I will see it happening once). I
> debugged it using a4j:log component and found that sometimes the ajax
> response does not contain the component with id 'myTableId'.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
_______________________________________________
richfaces-issues mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/richfaces-issues